note 117135 deleted from soapclient.soapclient by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:50:01 +0000 |
| Subject: | note 117135 deleted from soapclient.soapclient by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218073@lists.php.net to get a copy of this message | ||
Note Submitter: info at nospam x valiton x com
----
CAUTION:
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 );
?>
src:
http://php.net/manual/en/context.http.php#114314