eBay::API::Simple::HTML - Support for grabbing an HTML page via API call


eBay-API-Simple documentation  | view source Contained in the eBay-API-Simple distribution.

Index


NAME

Top

eBay::API::Simple::HTML - Support for grabbing an HTML page via API call

USAGE

Top

  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";
  }

PUBLIC METHODS

Top

new( { %options } }

  my $call = ebay::API::Simple::HTML->new();

execute( $url, $%args )

  $call->execute( 'http://en.wikipedia.org/wiki/Main_Page', { a => 'b' } );

This method will construct the API request based on the $verb and the $call_data and then post the request to the web service endpoint.

Options

$url (required)

URL for page to fetch

%$args (optional)

The supplied args will be encoded and appended to the URL

response_hash

Custom response_hash method, uses the output from LibXML to generate the hash instead of the raw response body.

response_dom

Custom response_dom method, provides a more relaxed parsing to better handle HTML.

BASECLASS METHODS

Top

request_agent

Accessor for the LWP::UserAgent request agent

request_object

Accessor for the HTTP::Request request object

request_content

Accessor for the complete request body from the HTTP::Request object

response_content

Accessor for the HTTP response body content

response_object

Accessor for the HTTP::Request response object

nodeContent( $tag, [ $dom ] )

Helper for LibXML that retrieves node content

errors

Accessor to the hashref of errors

has_error

Returns true if the call contains errors

errors_as_string

Returns a string of API errors if there are any.

PRIVATE METHODS

Top

_get_request_body

This method supplies the XML body for the web service request

_get_request_headers

This methods supplies the headers for the HTML API call

_get_request_object

This method creates the request object and returns to the parent class

AUTHOR

Top

Tim Keefer <tim@timkeefer.com>

COPYRIGHT

Top


eBay-API-Simple documentation  | view source Contained in the eBay-API-Simple distribution.