note 107523 deleted from function.stream-context-set-default by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 20:53:31 +0000 |
| Subject: | note 107523 deleted from function.stream-context-set-default by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187841@lists.php.net to get a copy of this message | ||
Note Submitter: Joan
----
<?php
//Code snippet taken from
// http://stackoverflow.com/questions/1336262/file-get-contents-behind-a-proxy
php $auth = base64_encode('LOGIN:PASSWORD');
$aContext = array(
'http' => array(
'proxy' => 'tcp://192.168.0.2:3128',
'request_fulluri' => true,
'header' => "Proxy-Authorization: Basic $auth",
),
);
stream_context_set_default($aContext);
$sFile = file_get_contents("http://www.google.com", False);
echo $sFile;
?>