Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of windylea  >  Socksed  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: An example for the usage of this class
Class: Socksed
Connect to a remote machine via a SOCKS server
Author: By
Last change: Update file
Date: 1 year ago
Size: 787 bytes
 

Contents

Class file image Download
<pre><?
include("socksed.php");

$socksed = new socksed;

/*
 * Adding SOCKS server to chain
 *
 * The format is version://username:password@hostname:port
 */

$socksed->chain[] = "socks4://127.0.0.1:1080";
$socksed->chain[] = "socks4a://example.net:1234";
$socksed->chain[] = "socks5://[2001:0db8:0000:0000:0000:ff00:0042:8329]:12891";

/*
 * Build a HTTP request
 */

$request = array(
    
"GET http://www.example.com/ HTTP/1.1"
    
"Host: www.example.com"
    
"Connection: Close"
);

$request implode($request"\r\n")."\r\n\r\n";

/*
 * Connect to the destination address through the SOCKS chain and make a request
 */
echo $socksed->send("www.example.com"80$request);

/*
 * Print the log messages
 */
print_r($socksed->log());
?></pre>