perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Powers, Dean" <dpow...@conxion.net>
Subject Re: Execute URL Query
Date Wed, 02 Oct 2002 03:02:27 GMT
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


Mime
View raw message