Coastal Web
01-04-2012, 01:56 AM
Hey there guys,
I'm trying to figure out how to use file_get_contents with a user/pass authenticated proxy server....
I've tried the following two implentations from snippets l've found online in various places, but neither seem to work.
Can anyone see what l'm doing wrong?
$auth = base64_encode('xxx:xxx');
$url = 'http://ipchicken.com';
$opts = array(
'http' => array (
'method'=>'GET',
'header'=>"Authorization: Basic $auth",
'proxy'=> 'tcp://69.162.140.112:62266'
)
);
$ctx = stream_context_create($opts);
file_get_contents($url, false, $ctx);
$aContext = array(
'http' => array(
'proxy' => "tcp://69.162.140.112:62266",
'request_fulluri' => True,
'userid'=>"xxx",
'password'=>"xxx"
),
);
$context = stream_context_create($aContext);
echo file_get_contents("http://www.ipchicken.com", 0, $context);
PS> my user/pass is correct l've triple checked.
I'm trying to figure out how to use file_get_contents with a user/pass authenticated proxy server....
I've tried the following two implentations from snippets l've found online in various places, but neither seem to work.
Can anyone see what l'm doing wrong?
$auth = base64_encode('xxx:xxx');
$url = 'http://ipchicken.com';
$opts = array(
'http' => array (
'method'=>'GET',
'header'=>"Authorization: Basic $auth",
'proxy'=> 'tcp://69.162.140.112:62266'
)
);
$ctx = stream_context_create($opts);
file_get_contents($url, false, $ctx);
$aContext = array(
'http' => array(
'proxy' => "tcp://69.162.140.112:62266",
'request_fulluri' => True,
'userid'=>"xxx",
'password'=>"xxx"
),
);
$context = stream_context_create($aContext);
echo file_get_contents("http://www.ipchicken.com", 0, $context);
PS> my user/pass is correct l've triple checked.