PHP Classes

PHP SOCKS5 Client: Establish TCP connections via a SOCKS 5 server

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 983 All time: 3,697 This week: 560Up
Version License PHP version Categories
socks-client 0.1.0GNU General Publi...5Networking, PHP 5
Description 

Author

This class can be used to establish TCP connections via a SOCKS 5 server.

It is an updated version of another class for the same purpose originally written by Sergey Cheeba. This version supports:

* Specifying the outgoing network interface for connecting to the SOCKS server
* Handling connection timeouts
* Tunnel DNS traffic through proxy
* SOCKS server authentication

Picture of Gunter Grodotzki
Name: Gunter Grodotzki <contact>
Classes: 1 package by
Country: South Africa South Africa
Age: 39
All time rank: 239116 in South Africa South Africa
Week rank: 170 Up4 in South Africa South Africa Up

Example

<?php
error_reporting
(E_ALL);
ini_set("display_errors", true);

include(
"class.socks5.php");

$request[] = "GET / HTTP/1.1";
$request[] = "Host: www.my-ip.co.za";
$request[] = "Connection: Close";

$socks5 = new socks5("192.168.2.2", 1080, "user", "pass");
//$socks5->set_interface("192.168.2.9");
$socks5->set_timeout(10);
$socks5->set_dnstunnel(false);

if(
$socks5->connect("www.my-ip.co.za", 80) === true)
{
   
$buffer = $socks5->request(implode("\r\n", $request) . "\r\n\r\n");
   
var_dump($buffer);
}

unset(
$socks5);
?>


  Files folder image Files (2)  
File Role Description
Plain text file class.socks5.php Class main lib
Accessible without login Plain text file example.php Example -

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:983
This week:0
All time:3,697
This week:560Up