View Full Version : Connect to site via proxy?

09-20-2009, 10:06 AM
Hi there, I've been searching for a way to connect to websites using proxies, but I've yet to find anything that works.

I want to be able to connect via a proxy that uses user/password authentication. Whether be socks5 or a http proxy running on port 8080.

So what the script would do is connect to lets say www.google.com on socks5 ip of x.x.x.x on port 1080 with username socksuser and password sockspass.

Is this possible?

Any help appreciated :)

09-20-2009, 09:09 PM
OK, so the following works:

$params = array
'http' => array
'method' => 'GET',
'header' => 'Proxy-Authorization: Basic ' . base64_encode(USERNAME . ':' . PASSWORD) . "\r\n\r\n",
'proxy' => 'tcp://74.xx.61.xxx:6xx99',
'request_fulluri' => true,
$context = stream_context_create($params);
echo file_get_contents('http://ipchicken.com', null, $context);


The only thing is I cannot get it to work with ssl/https. I've tried SSL context, but I am still very confused.

Any ideas?