1. Go to this page and download the library: Download clue/socks library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clue / socks example snippets
p = React\EventLoop\Factory::create();
// use google's dns servers
$dnsResolverFactory = new React\Dns\Resolver\Factory();
$dns = $dnsResolverFactory->createCached('8.8.8.8', $loop);
// create SOCKS client which communicates with SOCKS server 127.0.0.1:9050
$factory = new Socks\Factory($loop, $dns);
$client = $factory->createClient('127.0.0.1', 9050);
// now work with your $client, see below
$loop->run();
$ssl = $client->createSecureConnector();
// now create an SSL encrypted connection (notice the $ssl instead of $tcp)
$ssl->create('www.google.com',443)->then(function(React\Stream\Stream $stream){
// proceed with just the plain text data and everything is encrypted/decrypted automaticallyecho'connected to SSL encrypted www.google.com';
$stream->write("GET / HTTP/1.0\r\n\r\n");
// ...
});