PHP Classes

File: README.txt

Recommend this page to a friend!
  Classes of Nashruddin Amin  >  Hacker's HTTP Client  >  README.txt  >  Download  
File: README.txt
Role: Documentation
Content type: text/plain
Description: Quick introduction
Class: Hacker's HTTP Client
Automate retrieval and processing of Web pages
Author: By
Last change:
Date: 13 years ago
Size: 1,876 bytes


Class file image Download
phpWebHacks 1.5
This is an advanced HTTP client written in PHP. It simulates a real web browser,
only that you use it with lines of code rather than mouse and keyboard. Using
pure PHP, no Curl or other fancy dependencies needed. The functionality makes it
a perfect tool for HTTP scripting.

Author:  Nashruddin Amin -
License: GPL

* Support HTTP/1.1
* Cookies
* Redirects
* HTTP authentication
* Proxy
* Gzip encoding
* log HTTP streams for full debugging
* Parsing HTML forms
* Custom User-Agent

* head($url) 
  Make HTTP HEAD request to $url. Returns the response header in associative

* get($url)
  Make HTTP GET request to $url. It will handle all redirects and returns the last
  HTML body.

* post($url, $form=array(), $files=array())
  Make HTTP POST request to $url. Returns the last HTML body.

* parseForm($name_or_id, &$action, $html_string)
  Parse HTML forms and convert it to associative array.

* setProxy($host, $port, $user='', $pass='')
  Set the proxy server to be used.

* setDebug($is_debug)
  If is_debug is true, all HTTP streams will be logged. It's useful for debugging.

* setInterval($second)
  Set the delay between requests.

* setUserAgent($name)
  Assign a name to this HTTP client. It will appear in the 'User-Agent' field of the
  HTTP header.

See for more details.

This is a simple example to fetch a web page:

include 'phpWebHacks.php';

$h = new phpWebHacks;
$page = $h->get('');

See more examples at

Send comments, suggestions, and bug reports to

For more information send a message to info at phpclasses dot org.