Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
xfsunolesphp
Regular
Regular



Joined: Aug 23, 2003
Posts: 77

PostPosted: Fri Jun 11, 2004 9:51 pm Reply with quote

I need help to rewrite perl to php. I need somebody to do it. it will be next modules, it use SOAP+ PHP, XML.
 
View user's profile Send private message
stephen2417
Worker
Worker



Joined: Jan 18, 2004
Posts: 244
Location: Bristolville, OH

PostPosted: Sun Jun 13, 2004 4:44 am Reply with quote

This might not be a bad place to start...
http://www.google.com/search?q=%22perl+to+php%22 Very Happy
 
View user's profile Send private message Visit poster's website
xfsunolesphp







PostPosted: Mon Jun 14, 2004 11:40 am Reply with quote

Code:


#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;
use XML::Parser;

print SendSOAPAllPosters('
<APC_Search_Query>
  <WebSiteID>177783</WebSiteID>
  <PageNumber>1</PageNumber>
  <ProductsPerPage>15</ProductsPerPage>
  <CategoryID>101</CategoryID>
  <SearchText>Matrix</SearchText>
  <SortOrder>R</SortOrder>
  <MinWidth>5</MinWidth>
  <MaxWidth>30</MaxWidth>
  <MinHeight>10</MinHeight>
  <MaxHeight>60</MaxHeight>
  <MinPrice></MinPrice>
  <MaxPrice>50</MaxPrice>
</APC_Search_Query>
');

sub SendSOAPAllPosters {
my $sendxml = shift;
my $result = '';
 my $content = <<CONTENT
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetProductInformation xmlns="http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService">
<APCSearchXml>
<![CDATA[$sendxml]]>
 </APCSearchXml>
</GetProductInformation>
</soap:Body>
</soap:Envelope>
CONTENT ;

$ua = LWP::UserAgent->new();
$request = HTTP::Request->new(POST => 'http://webservice.allposters.com/ProductInformationService.asmx');
$request->header(SOAPAction => '"http://Webservice.Allposters.com/APCF.AffiliateWebService/ProductInformationService/GetProductInformation"'); $request->content($content); $request->content_type("text/xml; charset=utf-8"); $response = $ua->request($request); if ($response->is_success) {
my $responeXml = $response->content;
my $xmlp = new XML::Parser(Handlers => {
Start => \&StartGetProductInformationResponse,
End => \&EndGetProductInformationResponse,
Char => \&CharGetProductInformationResponse },
'Non-Expat-Options' => {
xmlResult => \$result}
);
eval {$xmlp->parse($responeXml)
};

if ($@) { $result = ''; } } else { print "bad\n"; } return $result; }

sub StartGetProductInformationResponse {
my $e = shift;
${$e->{'Non-Expat-Options'}{'xmlResult'}} = '';
my $tag = shift;

if ($tag eq 'GetProductInformationResult') {
$e->{'Non-Expat-Options'}{'GetProductInformationResult'} = 1; } }
sub CharGetProductInformationResponse { my $e = shift; my $val = shift; if ($e->{'Non-Expat-Options'}{'GetProductInformationResult'}) { ${$e->{'Non-Expat-Options'}{'xmlResult'}} .= $val; } }

 sub EndGetProductInformationResponse
{ my $e = shift; my $tag = shift;

if ($tag eq 'GetProductInformationResult') {
$e->{'Non-Expat-Options'}{'GetProductInformationResult'} = 0;
}
}
 1;

i need help to convert this to php
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©