note 114314 added to context.http
| From: | chris | Date: | Thu, 06 Feb 2014 06:14:08 +0000 |
| Subject: | note 114314 added to context.http | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198421@lists.php.net to get a copy of this message | ||
I had quite a bit of trouble trying to make a request with fopen through a proxy to a secure url. I
kept getting a 400 Bad Request back from the remote host. It was receiving the proxy url as the SNI
host. In order to get around this I had to explicity set the SNI host to the domain I was trying to
reach. It's apparently the issue outlined in this bug:
https://bugs.php.net/bug.php?id=63519
<?php
$domain = parse_url($file, PHP_URL_HOST);
$proxy_string = "tcp://" . WP_PROXY_HOST . ":" . WP_PROXY_PORT;
$opts = array(
'http' => array( 'proxy' => $proxy_string ),
'ssl' => array( 'SNI_enabled' => true, 'SNI_server_name'
=> $domain));
$context = stream_context_create($opts);
$handle = fopen( $file, 'r', false, $context );
?>
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/context.http.php
Edit -- https://master.php.net/note/edit/114314
Del: integrated -- https://master.php.net/note/delete/114314/integrated
Del: useless -- https://master.php.net/note/delete/114314/useless
Del: bad code -- https://master.php.net/note/delete/114314/bad+code
Del: spam -- https://master.php.net/note/delete/114314/spam
Del: non-english -- https://master.php.net/note/delete/114314/non-english
Del: in docs -- https://master.php.net/note/delete/114314/in+docs
Del: other reasons-- https://master.php.net/note/delete/114314
Reject -- https://master.php.net/note/reject/114314
Search -- https://master.php.net/manage/user-notes.php