1. Go to this page and download the library: Download rovazh/phpsocks library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rovazh / phpsocks example snippets
$client = new \PhpSocks\Client([
'host' => '127.0.0.1', // SOCKS5 server (IPv4, IPv6, or hostname)
'port' => 1080, // SOCKS5 server port
]);
try {
$stream = $client->connect('tcp://example.com:80');
$stream->write("GET / HTTP/1.0\r\n\r\n");
echo $stream->read(1024);
$stream->close();
} catch (\PhpSocks\Exception\PhpSocksException $e) {
// Handle exception
}