file_get_contents + https + proxy + authentificationS
am 21.12.2007 17:20:10 von pac1250Hi,
I am searching how to solve a problem and I dont find it :(
I want to access a page from a script behind a proxy :
(my script) <-> (a proxy with authentification) <-> (https serveur
with authentification)
------------------------------------------------------------ -----
I get this error :
PHP Warning: file_get_contents(): SSL: fatal protocol error in F:\Data
\Scripts-html\php-test-file_get_contents\HTTP_Proxy_auth.php on line
33
Warning: file_get_contents(): SSL: fatal protocol error in F:\Data
\Scripts-html\php-test-file_get_contents\HTTP_Proxy_auth.php on line
33
PHP Warning: file_get_contents(https://logs.ovh.net/xxx-xxxx.xxx/
logs-12-2007/): failed to open stream: Cannot connect to HTTPS server
through proxy
in F:\Data\Scripts-html\php-test-file_get_contents\HTTP_Proxy_a uth.php
on line 33
Warning: file_get_contents(https://logs.ovh.net/xxx-xxxx.xxx/
logs-12-2007/): failed to open stream: Cannot connect to HTTPS server
through proxy in F:
\Data\Scripts-html\php-test-file_get_contents\HTTP_Proxy_aut h.php on
line 33
(Error reporting is set to E_ALL)
------------------------------------------------------------ -----
Here is my script :
error_reporting(E_ALL);
$authPage = base64_encode("xxxxxxx:xxxxxxxxx");
$authProx = base64_encode("xxxxxxxxxx:xxxxxxxxx");
$url = 'https://logs.ovh.net/xxx-xxxx.xxx/logs-12-2007/';
$header = "Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n"
."Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3\r\n"
."Accept-Encoding: gzip,deflate\r\n"
."Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"
."Keep-Alive: 300\r\n"
."Proxy-Connection: keep-alive\r\n"
."Proxy-Authorization: Basic {$authProx}\r\n"
."Authorization: Basic {$authPage}";
$opts = array (
'proxy' => 'tcp://xxxxx.xxx.xx.xxxx.fr:8080',
'request_fulluri' => true,
'method'=>'GET',
'header'=>$header
);
var_dump($opts);
$ctx = stream_context_create(array('http'=>$opts,'https'=>$opts));
echo file_get_contents($url,false,$ctx);
?>
------------------------------------------------------------ -----
If someone see where is the problem, it would be cool ;)
thx