HTTP-LIB.PL Updates.

I've made some updates to the library to support proxied GETs, POSTs and HEADs. I also cleaned up the code to use fewer throw away buffers, save the retrieved header in $httpHead and the error code in $httpErrorCode. When an error occurs the HTTP buffer contains the HTTP header's first line that should contain the human readable error. Here's where to get it:

The proxy support is enabled by calling HTTPProxy ($host, $port); where host is the IP address that the proxy request will be sent to.

The actual routines available are:

  1. $fileName = the full pathname of the file to retrieve. Use '/' for the root directory.
  2. $site = name or IP address that the proxy will process (ie. the IP address to GET data from).
  3. $port = the site's HTTP port, usually 80, but sometimes 8080, 8008 etc.
  4. $queryString = String holding name/value pairs in the form: For example 'x=23&y=44' could be used to simulate a click on an image.
Here's some sample code that gets the data from URL using the proxy wingate:80 that's local to my network ...
$proxyHost = 'wingate';
$proxyPort = 80;

&HTTPProxy ($proxyHost, $porxyPort);

$port = 80;
$site = '';
$queryString = "isbn=0201634627";
$fileName = "/index.htm";

$buf = &HTTPGet ($fileName, $site, $port, $queryString);

unless ($httpErrorCode) {
  print 'DATA ->\n' . $buf . '<- END\n';
Needless to say, you should plug in real values in the example above.

I intend to enhance this code to:

Any questions, suggestion, etc. Mail me, Peter Gargano, at and flame, complain or ...

Last modified 17th June 1998, copyright © Peter Gargano 1998.