PHP Classes

File: gHttp.test.php

Recommend this page to a friend!
  Classes of Cesar D. Rodas   gHttp   gHttp.test.php   Download  
File: gHttp.test.php
Role: Example script
Content type: text/plain
Description: example
Class: gHttp
Stream wrapper to send HTTP POST and GET requests
Author: By
Last change: * Changing example
Date: 17 years ago
Size: 755 bytes
 

Contents

Class file image Download
<?php
include('http.php');
include(
'gHttp.php');

/*
#Examples of how to user this class with a proxy
$proxy['host']="proxy.host.com";
$proxy['port']="3128";
$proxy['user']="user";
$proxy['pass']="password";
$proxy['realm'] ="proxyrealm" ;
$proxy['mech']=""; #Proxy proxy_authentication_mechanism
*/
$f = fopen("ghttp://www.cesarodas.com/","r");
if (
$f === false) {
print
"Error: ".$gHttpErr;
}
print_r($headers);
while (
$body = fread($f, 1024) )
    print
$body;
fclose($f);
/*
** This will work only with PHP 5.
** The php stream wreaper http is unset
** and ghttp handle http queries.
*/
$f = fopen("http://www.cesarodas.com/","r");
print_r($headers);
while (
$body = fread($f, 1024) )
    print
$body;
fclose($f);
?>