NAME
HTTP::GHTTP - Perl interface to the gnome ghttp library
SYNOPSIS
use HTTP::GHTTP;
my $r = HTTP::GHTTP->new();
$r->set_uri("http://axkit.org/");
$r->process_request;
print $r->get_body;
DESCRIPTION
This is a fairly low level interface to the Gnome project's libghttp, which allows you to process HTTP requests to HTTP servers. There also exists a slightly higher level interface - a simple get() function which takes a URI as a parameter. This is not exported by default, you have to ask for it explicitly.
API
HTTP::GHTTP->new([$uri, [%headers]])
Constructor function - creates a new GHTTP object. If supplied a URI it will automatically call set_uri for you. If you also supply a list of key/value pairs it will set those as headers:
my $r = HTTP::GHTTP->new(
"http://axkit.com/",
Connection => "close");
$r->set_uri($uri)
This sets the URI for the request
$r->set_header($header, $value)
This sets an outgoing HTTP request header
$r->process_request()
This sends the actual request to the server
$r->get_header($header)
This gets the value of an incoming HTTP response header
$r->get_body()
This gets the body of the response
$r->get_error()
If the response failed for some reason, this returns a textual error
$r->set_authinfo($user, $password)
This sets an outgoing username and password for simple HTTP authentication
$r->set_proxy($proxy)
This sets your proxy server, use the form "http://proxy:port"
$r->set_proxy_authinfo($user, $password)
If you have set a proxy and your proxy requires a username and password you can set it with this.
get($uri, [%headers])
This does everything automatically for you, retrieving the body at the remote URI. Optionally pass in headers.
AUTHOR
Matt Sergeant, matt@sergeant.org
LICENSE
This is free software, you may use it and distribute it under the same terms as Perl itself. Please be aware though that libghttp is licensed under the terms of the LGPL, a copy of which can be found in the libghttp distribution.
BUGS
No support for POST (yet).