Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Joshua Gilman  >  HTTPSock  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: File testing the class
Class: HTTPSock
Send HTTP requests to a Web server using sockets
Author: By
Last change:
Date: 2007-01-18 21:31
Size: 606 bytes
 

Contents

Class file image Download
<?php

require_once('HTTPsock.class.php');

$socket = new HTTPSock();

/* Simple GET */
echo $socket->HTTPRequest("GET""http://www.google.com/");

/* Advanced POST, use array's for overwriting header values and using POST variables */
$header = array("Referer" => "http://www.google.com");
echo 
$socket->HTTPRequest("POST""www.google.com/someform.phtml", array("somevar" => "somevalue"), $header);

/* Returns the a cookie with the name 'somecookie' */
echo $socket->cookies['somecookie'];

/* Returns what the content was encoded in */
echo $socket->headers['Content-Encoding'];

?>