Web proxy base class.
More...
|
| open ($address, $port) |
|
| read ($size) |
|
| close () |
|
| isOpen () |
|
| readLength ($length, $headers, WebRequest $request, &$aborted) |
|
| readAll ($headers, WebRequest $request) |
|
| open ($address, $port) |
| Opens socket. More...
|
|
| read ($size) |
| Reads raw data from socket. More...
|
|
| close () |
| Closes socket.
|
|
| isOpen () |
| Returns true if socket is open. More...
|
|
| readChunked ($headers, WebRequest $request) |
| Reads chunked content from socket and puts chunks to single string. More...
|
|
| readLength ($length, $headers, WebRequest $request, &$aborted) |
| Reads data with specified length from socket. If socket closes connection or no more data is available to reach length, throws WebRequestException. More...
|
|
| readAll ($headers, WebRequest $request) |
| Reads all available data from socket until it closes connection. More...
|
|
| readUntil ($text) |
| Reads all available data from socket until specified substring is found inside contents. More...
|
|
| readHeaders () |
| Reads response headers. More...
|
|
| write (WebRequest $request) |
| Writes request to socket. More...
|
|
|
| $socket = null |
|
| $login = null |
|
| $password = null |
|
| $address |
|
| $port |
|
__construct |
( |
|
$address, |
|
|
|
$port |
|
) |
| |
Constructor.
- Parameters
-
string | $address | Proxy address (hostname or IPv4 address) |
int | $port | Proxy port |
Returns login for proxy.
- Return values
-
string | Login string (or null, if no auth required) |
Returns password for proxy.
- Return values
-
string | Password string (or null, if no auth required) |
Returns true if proxy needs to be authenticated.
- Return values
-
bool | True if proxy needs to be authenticated |
setAuth |
( |
|
$login, |
|
|
|
$password |
|
) |
| |
Sets login and password for proxy.
- Parameters
-
string | $login | Login string (or null, if no auth required) |
string | $password | Password string (or null, if no auth required) |
Sets socket for proxy. This can be another proxy or network socket.
Remember to always set underlying proxy socket before using proxy networking functions.
It is possible to build proxy chain using this function.
Example:
$proxy3 = new HttpProxy('test.site.com', 808);
$proxy2 = new Socks5Proxy('123.100.200.10', 1080);
$proxy1 = new Socks4AProxy('221.111.111.111', 777);
$proxy3->setSocket($proxy2);
$proxy2->setSocket($proxy1);
$proxy1->setSocket(new FileSocket);
This will create a chain:
221.111.111.111:777 (socks4a) -> 123.100.200.10:1080 (socks5) -> test.site.com:808 (HTTP proxy)
- Parameters
-
The documentation for this class was generated from the following file: