rendered paste body<?php$ip = "193.69.165.21";$port = 80;// Open socket$socket = fsockopen( $proxyIP, $proxyPort );// Start building packet // Socks version: 4$packet .= chr(4);// Command: Connect(1)$packet .= chr(1);// Port: 80 (2 bytes)$packet .= chr(floor($port / 256));$packet .= chr($port % 256);// Address: 193.69.165.21 (Split by . and put in each byte)$parts = explode( ".", $ip );$packet .= chr(intval($parts[0]));$packet .= chr(intval($parts[1]));$packet .= chr(intval($parts[2]));$packet .= chr(intval($parts[3]));// Terminate packet with a 0 byte$packet .= chr(0);// Send packet ...fwrite( $socket, $packet, 9 );// Reading and parsing the response is left as an exercise to the reader// Ref: http://www.ufasoft.com/doc/socks4_protocol.htm?>