The Wayback Machine - https://web.archive.org/all/20061018062009/http://scripts.incutio.com/httpclient/demo.php
INCUTIO HOME | SCRIPTS | CONTACT

HttpClient Demo

HttpClient Home | Download HttpClient (txt) | HttpClient Manual | HttpClient Examples

This demo (which may take a few seconds to load) attempts to retrieves the front page of Amazon.com and reports its size in bytes. Debug mode is switched on to show what the script is doing. This demonstrates the script automatically following redirections and maintaining cookies and referrers between sessions.

$client = new HttpClient('www.amazon.com');
$client->setDebug(true);
if (!$client->get('/')) {
    echo '<p>Request failed!</p>';
} else {
    echo '<p>Amazon home page is '.strlen($client->getContent()).' bytes.</p>';
}
HttpClient Debug: Request
GET / HTTP/1.0
Host: www.amazon.com
User-Agent: Incutio HttpClient v0.9
Accept: text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*
Accept-encoding: gzip
Accept-language: en-us

HttpClient Debug: HTTP/1.1 200 OK
HttpClient Debug: Received Headers
Array
(
    [date] => Wed, 18 Oct 2006 06:20:11 GMT
    [server] => Server
    [set-cookie] => Array
        (
            [0] => skin=noskin; path=/; domain=.amazon.com; expires=Wed, 18-Oct-2006 06:20:11 GMT
            [1] => session-id-time=1161673200l; path=/; domain=.amazon.com; expires=Tue Oct 24 07:00:00 2006 GMT
            [2] => session-id=102-4773020-4088955; path=/; domain=.amazon.com; expires=Tue Oct 24 07:00:00 2006 GMT
        )

    [x-amz-id-1] => 0AT672KDMSZ69MM7V32T
    [x-amz-id-2] => FHsW3/08ZAyPIourBOjG7CXhBF2MkNVO
    [vary] => Accept-Encoding,User-Agent
    [content-encoding] => gzip
    [content-type] => text/html; charset=ISO-8859-1
    [connection] => close
)
HttpClient Debug: Content is gzip encoded, unzipping it
HttpClient Debug: Persisting referer: http://www.amazon.com/

Amazon home page is 97914 bytes

scripts.incutio.com light logo