|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-02 16:04 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
Description: ------------ When fopen'ing a web page, and using a proxy in the stream context, there is no way to specify proxy username and password N.B. non-authenticating proxies work just fine. Reproduce code: --------------- <?php $opts = array('http' => array( 'proxy' => 'tcp://localhost:2001/', 'request_fulluri' => True, 'proxy_login' => 'fest1', 'proxy_password' => 'xxx' ) ); $context = stream_context_create($opts); $fp=fopen("http://www.lgl.lu/", "r", false, $context) or die("Cannot load\n"); print "fp=$fp"; while(!feof($fp)) { $in=fgets($fp,1024); print $in; } ?> Expected result: ---------------- It should display the page from www.lgl.lu Actual result: -------------- It logs an error: [Fri Jun 29 11:06:21 2007] [error] [client ::1] PHP Warning: fopen(http://www.lgl.lu/) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP request failed! HTTP/1.0 407 Proxy Authentication Required\r\n in /home/aknaff/public_html/php-test/download.php on line 14 and this even though login and password are correct.