PHP WebSocket2 Library
PHP5 Library for browsing web
Main Page
Data Structures
Examples
proxy_authentication.php
This is an example of how to use proxies with authentication.
<?php
require
'../websock2.php'
;
//Create file socket
$socket =
new
FileSocket
;
//Create SOCKS5 proxy
//You can also create HttpProxy, Socks4AProxy and Socks4Proxy
$proxy =
new
Socks5Proxy
(
'proxy.address.here'
, 3128);
//Set authentication data
$proxy->setAuth(
'login'
,
'password'
);
//Assign socket to proxy
$proxy->setSocket($socket);
//Run request via proxy and echo response body contents (without headers)
echo $proxy->sendRequest(
WebRequest::createFromUrl
(
'http://php.net'
))->getBody();
Generated on Sun Jan 25 2015 20:05:38 for PHP WebSocket2 Library by
1.8.9.1