Login   Register  
PHP Classes
elePHPant
Icontem

File: gHttp.test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 7 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($f1024) ) 
    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($f1024) ) 
    print 
$body;
fclose($f);
?>