This creates an Internet object in Perl on which you use the functions provided in this module to create more specific connection objects. The objects and functions that create them are:use Win32::Internet; $Connection = Win32::Internet->new();
Internet connections (the main object, with
FTP sessions (with
HTTP sessions (with
HTTP requests (with
This module provides different levels of implementation of the Win32 Internet functions. Some routines use several Win32 API functions to perform a complex task in a single call; they are simpler to use, but less powerful. Other functions implement nothing more and nothing less than the corresponding API function, so you can use all of their power, but with some additional programming steps.
For example, the function
FetchURL fetches the contents
of any HTTP, FTP, or Gopher URL with a simple command:
You can achieve the same result with this series of commands, which is what$inet = new Win32::Internet(); $file = $inet->FetchURL("http://www.yahoo.com");
$inet = new Win32::Internet(); $url = $inet->OpenURL("http://www.yahoo.com"); $file = $url->ReadFile(); $url->Close();
You can supply$inet = Win32::Internet->new();
newwith an optional list of arguments (or a reference to a hash containing them) that looks like this:
The parameters and their values are:Win32::Internet->new [useragent, opentype, proxy, proxybypass, flags] Win32::Internet->new [$hashref]
The user-agent string passed to HTTP requests. Default is
How to access the Internet (e.g., directly or using a proxy). Default is
Name of the proxy server (or servers) to use. Default is none.
Optional list of host names or IP addresses that are known locally. Default is none.
Additional flags affecting the behavior of the function. Default is none.
If you pass a hash reference to the function, the following values are taken from the hash:
The following methods can be used on Internet connection objects:%hash=( "useragent" => "useragent", "opentype" => "opentype", "proxy" => "proxy", "proxybypass" => "proxybypass", "flags" => flags, );
The methods described in this section are used to control
FTP sessions. They apply to FTP session objects created by
FTP method on an Internet connection object.
FTP creates an open FTP session and assigns it
to an object (
The following methods are used on FTP session objects:use Win32::Internet; $inet = new Win32::Internet(); $inet->FTP($FTP, "hostname", "username", "password");
This opens the session and creates the HTTP session objectuse Win32::Internet; $inet = new Win32::Internet(); $inet->HTTP($http, "hostname", "username", "password");
$http. The following methods can be used on HTTP session objects: