How to do HTTPS requests via proxy server
The proxy server is tinyproxy
on debian
code
$context = stream_context_create([
'http' => [
'proxy' => 'tcp://xx.xx.xx.xx:8888',
'request_fulluri' => true
]
]);
echo file_get_contents('https://www.google.com', false, $context);
error
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol in C:\wamp\www\google\test.php on line 10
Warning: file_get_contents(https://www.google.com): failed to open stream: Cannot connect to HTTPS server through proxy in C:\wamp\www\google\test.php on line 10
I would recommend cURL to do this. Somewhere on stackoverflow a user said this and I totally agree.
The problem which causes your second warning can be fixed by changing 'http' in stream_context_create to 'https'