ePages 6.14.0 - DE_EPAGES/RemoteSearch/API/Object/HTTPClient.pm

Package DE_EPAGES::RemoteSearch::API::Object::HTTPClient

HTTP communication adapter
All HTTP requests namely get, post, delete have in commen:

Functions

delete
get
new
ping
post

delete

Construct and execute a HTTP::Request::Commen::DELETE using $URL and $hHeaders

Syntax
my $HTTPResponse = $Adapter->delete($Path, $hHeader );
Example
my $HTTPResponse = $Adapter->delete($Path, {'PriorityHeader' => true});
Input
$URL (ref.hash)
URL to post to
$hHeaders (ref.hash)
HTTP headers
Return
$HTTPResponse (HTTP::Response)
HTTP::Response object

get

Construct and execute a HTTP::Request::Common::GET request using $URL and $hHeader

Syntax
my $HTTPResponse = $Adapter->get($Path, $hHeaders );
Input
$URL (URI::URL)
URL
$hHeaders (ref.hash)
additional http headers
Return
$HTTPResponse (HTTP::Response)
HTTP::Response object

new

creates a new remote adapter

Syntax
my $Adapter = DE_EPAGES::RemoteSearch::API::Object::HTTPClient->new( %options );
Input
%options - used keys:
hash
Return
$Adapter (DE_EPAGES::RemoteSearch::API::Object::HTTPClient)
new instance

ping

Checks if remote server is reachable via Net::Ping (ICMP). Timout limit is derieved from $self->userAgent->timeout().

Syntax
$Adapter->ping($Hostname);
Example
eval { $Adapter->ping($Hostname); $Adapter->get($URL); };
Input
$Hostname (string)
hostname or ip address to ping
Return
$IsReachable (boolean)
only true if host response correctly in time

post

Construct a HTTP::Request::Common::POST using $Content, $hHeaders and execute the request.

Syntax
my $HTTPResponse = $Adapter->post($Path, $hHeader, $Content );
Example
my $HTTPResponse = $Adapter->post($Path, {'PriorityHeader' => true}, 'Body of my POST...' );
Input
$URL (ref.hash)
URL to post to
$hHeaders (ref.hash)
HTTP headers
$Content (String)
Body/Content of POST request
Return
$HTTPResponse (HTTP::Response)
HTTP::Response object