You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Powers, Dean" <dp...@conxion.net> on 2002/10/02 05:02:27 UTC

Re: Execute URL Query

Found a solution using a traditional Perl UserAgent Request. I wonder if
there is a more elegant way using Embperl, especially the next step for
parsing the returned XML.

The traditional method that gets the job done:

[-
use LWP::UserAgent;
# use HTTP::Request::Common qw(POST);

$ua = new LWP::UserAgent;
$ua->agent("Netscape 3.0");

$req = new HTTP::Request GET
=>"http://xml.amazon.com/onca/xml2?t=webservices-20&dev-t=D8907FASD398&Keywo
rdSearch=dogs&mode=books&type=lite&page=1&f=xml";

# Pass request to the user agent and get a response back 
  $res = $ua->request($req);
  
# Put the response into a page array
  @page = $res->content;

  print @page;

  1;

-]

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org