Your proxy will reply that authentication is required. You can scratch your head and think "but I provide authentication!"
The problem is that the value of 'header' applies only to http connections. To authenticate a proxy server, you first need to extract the file from HTTP before the context is valid for use on FTP.
<?php $opts = array('ftp' => array( 'proxy' => 'tcp://vbinprst10:8080', 'request_fulluri'=>true, 'header' => array( "Proxy-Authorization: Basic $auth" ) ), 'http' => array( 'proxy' => 'tcp://vbinprst10:8080', 'request_fulluri'=>true, 'header' => array( "Proxy-Authorization: Basic $auth" ) ) ); $context = stream_context_create($opts); $s = file_get_contents("http://www.example.com",false,$context); $s = file_get_contents("ftp://anonymous: anonymous@ftp.example.org ",false,$context); ?>
Teun lassche
source share