eBay::API::Simple::HTML - Support for grabbing an HTML page via API call
my $call = eBay::API::Simple::HTML->new(); $call->execute( 'http://en.wikipedia.org/wiki/Main_Page', { a => 'b' } ); if ( $call->has_error() ) { die "Call Failed:" . $call->errors_as_string(); } # getters for the response DOM or Hash my $dom = $call->response_dom(); my $hash = $call->response_hash(); # collect all h2 nodes my @h2 = $dom->getElementsByTagName('h2'); foreach my $n ( @h2 ) { print $n->findvalue('text()') . "\n"; }
my $call = ebay::API::Simple::HTML->new();
$call->prepare( 'http://en.wikipedia.org/wiki/Main_Page', { a => 'b' } );
This method will construct the API request based on the $verb and the $call_data.
URL for page to fetch
The supplied args will be encoded and appended to the URL
Custom response_hash method, uses the output from LibXML to generate the hash instead of the raw response body.
Custom response_dom method, provides a more relaxed parsing to better handle HTML.
Accessor for the LWP::UserAgent request agent
Accessor for the HTTP::Request request object
Accessor for the complete request body from the HTTP::Request object
Accessor for the HTTP response body content
Accessor for the HTTP::Request response object
Helper for LibXML that retrieves node content
Accessor to the hashref of errors
Returns true if the call contains errors
Returns a string of API errors if there are any.
This method supplies the XML body for the web service request
This methods supplies the headers for the HTML API call
This method creates the request object and returns to the parent class
Tim Keefer <tim@timkeefer.com>
Tim Keefer 2009
To install eBay::API::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm eBay::API::Simple
CPAN shell
perl -MCPAN -e shell install eBay::API::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.