Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/progerxp/phisocks
SOCKS4/4a/5/5h client implementation for PHP 5.2+
https://github.com/progerxp/phisocks
Last synced: about 2 months ago
JSON representation
SOCKS4/4a/5/5h client implementation for PHP 5.2+
- Host: GitHub
- URL: https://github.com/progerxp/phisocks
- Owner: ProgerXP
- Created: 2015-03-17T11:16:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-01-27T17:00:01.000Z (almost 4 years ago)
- Last Synced: 2023-03-23T09:25:06.636Z (almost 2 years ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phisocks
**SOCKS4/4a/5/5h client implementation for PHP 5.2+**Standalone using native PHP sockets.
Supports basic authentication and **CONNECT** command.
Supports TCP and IPv4 only.
Switch between 4(5) and 4a(5h) by adjusting `$remoteDNS`.
Consult source code for detailed configuration info.
Released in public domain.
* SOCKS 4 spec: http://www.openssh.com/txt/socks4.protocol
* SOCKS 4a spec: http://www.openssh.com/txt/socks4a.protocol
* SOCKS 5 spec: https://www.ietf.org/rfc/rfc1928.txt
* SOCKS 5h is (per cURL definition) SOCKS 5 with remote DNS resolution
* SOCKS 5 Username/Password auth spec: https://tools.ietf.org/html/rfc1929## Usage example
```PHP
// Create new instance and set it up.
$phisocks = Phisocks::make('127.0.0.1');
$phisocks->remoteDNS = true;
$phisocks->basicAuth('socksy', 'sassy');// Open remote connection to SOCKS server which opens it to the target
// (google.com:80) and fails on error.
$phisocks->connect('google.com', 443);// For plain HTTP requests this is not necessary but if HTTPS is expected
// you will get blank response without enavling client crypto.
$phisocks->enableCrypto();// Everything is up to the plan - tunnel some data. HTTP here is just
// an example.
echo $phisocks->httpGET('/');// Connection will also be dropped when the object is destroyed.
$phisocks->close();
```