affee 0 Newbie Poster

I have a script that needs to extract data using perl modules.

I cannot write it using php because the site would need a complete rewrite.

I need to get a string (it is xml) sent by a post to a php script. and I have no idea how. I am prepared to donate a fee if need be.

#!/usr/bin/perl -w

use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
##use SOAP::Lite;
use SOAP::Lite ( +trace => 'all', readable => 1, outputxml => 1, );
use CGI::Carp qw/fatalsToBrowser/;
##use SOAP::WSDL;  - christ this works!
use strict;
use warnings;
print "Content-Type: text/xml; charset=utf-8";
my $fieldsearch = 0;
my $fieldvalue = "cats";

my $message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://babel.webservices.book.nielsen.com/xsd\">
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:getSearchService>
         <xsd:param0>
            <xsd:clientId>BookmarcusBDWS01</xsd:clientId>
            <!--Optional:-->
            <xsd:currency>GBP</xsd:currency>
            <xsd:format>7</xsd:format>
            <xsd:from>0</xsd:from>
            <xsd:indexType>0</xsd:indexType>
            <!--Optional:-->
            <xsd:marketSegment>UK</xsd:marketSegment>
            <!--1 or more repetitions:-->
            <xsd:params>
               <!--Optional:-->
               <xsd:fieldLogic>
                  <xsd:fieldLogic>0</xsd:fieldLogic>
               </xsd:fieldLogic>
               <xsd:fieldSearch>";

              my $FS = "</xsd:fieldSearch><xsd:fieldValue>";

               my $FV = "</xsd:fieldValue></xsd:params><xsd:password>mc709cpq264i</xsd:password><xsd:requestId>TestSearch</xsd:requestId>
            <xsd:resultView>2</xsd:resultView>
            <!--1 or more repetitions:-->
            <xsd:sortField>
               <xsd:sortField>1</xsd:sortField>
               <xsd:sortOrder>1</xsd:sortOrder>
            </xsd:sortField>
            <!--Optional:-->
            <xsd:territory>UK</xsd:territory>
            <xsd:to>4</xsd:to>
         </xsd:param0>
      </xsd:getSearchService>
   </soapenv:Body>
</soapenv:Envelope>";
my $sendit= $message.$fieldsearch.$FS.$fieldvalue.$FV;

my $userAgent = LWP::UserAgent->new();
my $request = HTTP::Request->new(POST => 'http://wsqa.nielsenbookdataonline.com/webservices/services/BDOLWebService?wsdl');
$request->header(SOAPAction => '"http://babel.webservices.book.nielsen.com/xsd"');

$request->content($sendit);
$request->content_type("text/xml; charset=utf-8");

my $response = $userAgent->request($request);

if($response->code == 200) {
	print $response->as_string;

## i need to send this $response to a php script
}
else {
	print $response->error_as_HTML;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.