| | |
reading a variable in to my script
![]() |
•
•
Join Date: Mar 2009
Posts: 4
Reputation:
Solved Threads: 0
I need to access 2 variables sent to this script;
fieldsearch and fieldvalue, both are sent from a php script (using passthru) but the sytax is incorrect as I get a 500 error :
[Mon Jun 8 12:17:51 2009] perlSOAP.cgi: Global symbol "$fieldsearch" requires explicit package name at perlSOAP.cgi line 64.
[Mon Jun 8 12:17:51 2009] perlSOAP.cgi: Global symbol "$fieldvalue" requires explicit package name at perlSOAP.cgi line 64.
help!!
fieldsearch and fieldvalue, both are sent from a php script (using passthru) but the sytax is incorrect as I get a 500 error :
[Mon Jun 8 12:17:51 2009] perlSOAP.cgi: Global symbol "$fieldsearch" requires explicit package name at perlSOAP.cgi line 64.
[Mon Jun 8 12:17:51 2009] perlSOAP.cgi: Global symbol "$fieldvalue" requires explicit package name at perlSOAP.cgi line 64.
help!!
Perl Syntax (Toggle Plain Text)
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; use SOAP::Lite; use CGI::Carp qw/fatalsToBrowser/; use warnings; use CGI::Simple; print "Content-Type: text/xml; charset=utf-8"; #foreach my $key (sort(keys(%ENV))) { # print "$key = $ENV{$key}<br>\n"; #} my $fieldsearch =param('fieldsearch'); my $fieldvalue = param('fieldvalue'); 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; } else { print $response->error_as_HTML; }
![]() |
Similar Threads
- NEED help to pass javascript variable to php (PHP)
- Help!need Help reading the bash script (Shell Scripting)
- How do you grab a value from a stylesheet? (JavaScript / DHTML / AJAX)
- get rid of blank lines with strreplace() (PHP)
- Hover Image Position ??? (HTML and CSS)
- call scripts from a different directory (Shell Scripting)
- paging & _POST variables (PHP)
- Using find in a bash shell script (Shell Scripting)
- Now, where did I see that before? DELL (Windows NT / 2000 / XP)
Other Threads in the Perl Forum
- Previous Thread: LWP for login to an web application
- Next Thread: Passing variable name to function
| Thread Tools | Search this Thread |






imple;