<pre><?
include("socksed.php");
$socksed = new socksed;
# The SOCKS server address
$socksed->hostname = "127.0.0.1";
# The SOCKS server port
$socksed->port = 1080;
# Timeout ( in seconds )
$socksed->timeout = 30;
# Other options
$socksed->version = 5; # SOCKS version can be 4, 5 or 4.5
# $socksed->username = "username"; # For authentication to the SOCKS server
# $socksed->password = "password"; # For authentication to the SOCKS server
# $socksed->context = array(....); # It's now possible to use context while connection to the server (PHP 5 only), see stream_context_create() for more informations
# Build a HTTP request
$request = array(
"GET http://www.google.com/ HTTP/1.1",
"Host: www.google.com",
"Connection: Close"
);
$request = implode($request, "\r\n")."\r\n\r\n";
# Connect to the destination address through the SOCKS server and make a request
echo $socksed->connect("www.google.com", 80, $request);
# Build another HTTP request
$another_request = array(
"GET http://www.google.com/imghp?hl=en&tab=wi HTTP/1.1",
"Host: www.google.com",
"Connection: Close"
);
$another_request = implode($another_request, "\r\n")."\r\n\r\n";
# Connect to the destination address through the SOCKS server and make a request
# echo $socksed->connect("www.google.com", 80, $another_request);
if($socksed->connect("www.google.com"))
{
echo $socksed->send($another_request);
$socksed->disconnect();
}
echo $socksed->error;
?></pre>