Unable to find the socket transport "https"
Solution 1
also for ssl you need to prefix the host with ssl://
Solution 2
Uncomment the line: extension=php_openssl.dll
in php.ini
Solution 3
You should be using just the hostname, not the URL in the fsockopen call. You'll need to provide the uri, minus the host/port in the actual HTTP headers. As @Martijin noted, and as listed in the manual page, you'll need to preface your host name with ssl:// for SSL or tls:// if using transport layer security.
Manual page for fsockopen. Look at Example #1.
Solution 4
Let's say you wanted to grab NY Times, which enforces HTTPS:
Incorrect:
$client = stream_socket_client('https://www.nytimes.com', $errno, $errstr, 30);
Correct:
$client = stream_socket_client('tcp://www.nytimes.com:443', $errno, $errstr, 30);
Note I've replaced https://
with tcp://
and appended the 443 port to the hostname.
I guess we can say that stream_socket_client()
does not speak URLs.
Solution 5
Switching to ssl://
worked for me but I kept getting a BAD REQUEST response. I found that I needed to add one more line to declare explicitly my Host Header as described here and ensure that I've updated my HTTP from HTTP/1.0
to HTTP/1.1
:
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Host: www.sandbox.paypal.com\r\n";
Piotr L
Updated on December 06, 2020Comments
-
Piotr L over 3 years
I'm using this to check for the availability of a URL:
$fp = fsockopen($url, 443, $errno, $errstr);
and I get this error back...
Warning: fsockopen() [function.fsockopen]: unable to connect to https://example.com/soapserver.php:443 (Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?) in C:\Home etc etc....
I'm using an IIS server btw,( no its not my doing! ) so I think its something to do with not having open-ssl, but I'm not sure. Can anyone help please?
I did a phpinfo() and I do have ssl, but on IMAP and cURL, thats all.
Any ideas?
-
Jay over 15 yearsThis is the real answer, but tvanfosson clarified it :)
-
The Onin about 7 years@Chris J Allen must've been desperate times
-
uudaddy over 3 yearsDo I need to do anything with php (sorry being a newbie on php) after I edited that file? Thank you.
-
uudaddy over 3 yearsJust realized this line is for Windows (dll), and it does not apply to Linux which I am using.
-
Salem almost 2 yearsFull answer
$fp = fsockopen('ssl://'.$host, $prt , $errno , $errstr , 4) ;