note 27864 deleted from function.fopen by alindeman
| From: | alindeman@php.net | Date: | Sat, 17 May 2003 21:07:32 +0000 |
| Subject: | note 27864 deleted from function.fopen by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48265@lists.php.net to get a copy of this message | ||
Note Submitter: thoughtabout <@t> gmx.de
To access files through a proxyserver which needs authentification use Curl:
http://www.php.net/manual/en/ref.curl.php
Example code:
$url = "http://your.adress.com/bla/bla?bla=bla";
$user_agent = "Opera rulez";
$proxyname = "AdressOfProxy";
$proxyport = "PortOfProxy";
$username = "ProxyUserName";
$userpassword = "ProxyUserPassword";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_PROXY, "$proxyname:$proxyport");
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "$username:$userpassword");
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;