mHTTP - simple HTTP get with support for redirects and cookies.
use mHTTP;
$http = new mHTTP;
$html = $http->request (url => 'http://my.host.net/test/', redirect => 1);
if ($http->error) {
die ("fatal: " . $http->error);
}
if ($http->status !~ /^2/) {
die ("fatal: http error: " . $http->status . ' ' . $http->msg);
}
print ($html);
Does simple HTTP or HTTPS GET, with possible automatic redirect and limited handling of cookies (see reset_cookies).
Create a new mHTTP object. You can optionally pass arguments like redirect, socket or list, see request method.
Allows you to set and HTTP request headers except Host, which is set automatically based on the URL hostname passed to the request method.
Reset all cookies which may have been set by the server in a previous request. Unlike standard browsers and because of the limited use of this package, all cookies are sent to any server thus violating the standard cookie rules. All cookies are also kept until a reset_cookies or until the object is destroyed. No cookies are stored on disk.
Does a HTTP or HTTPS GET request. The possible parameters are url which
defines the URL to get, redirect to cause an immediate redirect is the HTTP
reply status is 301, 302 or 307, socket => 1, to specify that a socket
to the HTTP(S)
connection shoul be returned as a result of a successful request or
list => 1, to specify that a list of lines (split on new line) should be
returned. If neither socket nor list are specified, a buffer containing
the body of the HTTP reply is returned. In case of errors, undef is returned.
Note that an HTTP error (e.g. 404 not found) is not considered an error by
the request method. You should use the status method to get the reply
status and decide if an error occured.
Returns the HTTP reply numeric status code.
Returns the HTTP reply textual status.
Returns the HTTP reply header specified by name.
Does %HH type encoding of all charaters in text except 0-9, A-Z and a-z.
Returns the last error message set by the request method. Other methods do not set errors.
Franck, franck@cvt.dk
1.5 2004/10/11 14:58:02