List, I have just started with the following code that *should* send and XML over HTTP request and receive the response, but there is a pblm, and I can't for the life of me figure it out. code: ==================== #!/usr/bin/perl -w BEGIN { $| = 1; open (STDERR, ">&STDOUT"); print qq~Content-type: text/html\n\n~; } use HTTP::Request::Common; use LWP::UserAgent; use HTTP::Response; ####################################### #perl script for sending xml over http # #authored by Mac Rost # #copyright 2002 # #######################################
# Get the input read(STDIN, my $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); #begin loop for xml query foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; #take out phpsessid and resType from xml string we're trying to create if ($name ne 'PHPSESSID' and $name ne 'resType'){ $xml.= "<$name>$value</$name>"; } # $FORM{$name} = $value; if ($name eq 'resType'){ $resType = $value } } #end xml query loop #Build xml query my $strXML = "<HotelSessionRequest method='runHotelAvailabilityListQuery'><HotelAvailabilityListQuery>" . $xml . "</HotelAvailabilityListQuery></HotelSessionRequest>"; #print($strXML); my $datatosend = "cid=22&resType=$resType&xml="; my $appendURL = $datatosend . $strXML; #print($appendURL); #Send the xml query to tnow $ua = LWP::UserAgent -> new; $ua -> request(POST 'http://test.travelnow.com/external/xmlinterface.jsp$appendURL'); my $response = $ua->request(POST 'http://test.travelnow.com/external/xmlinterface.jsp$appendURL'); if ($response->is_success) { print($response->content); } else { print($response->error_as_HTML); } print <<ENDHTML; <HTML> <HEAD> <TITLE>CGI Test</TITLE> </HEAD> <BODY> <A HREF="http://www.travelnow.com/external/xmlinterface.jsp?$datatosend$strXML">Click Here</A> <P>http://www.travelnow.com/external/xmlinterface.jsp\?$datatosend$strXML</P> <P></P> </BODY> </HTML> ENDHTML =========================== note, the name/value pairs come from a form with the 'post' method, they are city, stateProvince, arrivalDate, departureDate, county. Any and all help would be appreciated! Thanks! Mac -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]