Function call

$hole = fsockopen("https://217.ххх.ххх.ххх:81/History/HistoryService.asmx", 81, $errno, $errstr, 10); 

leads to an error

(Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?)

Question: where is the support of the https protocol in the socket configured, contact the provider or do you need to make some settings in your files?

  • a little wrong put it, I need to send a request to this address and get back the xml-data, I can not create a connection via https. fsockopen ("217.xxx.xxx.xxx", 81, $ errno, $ errstr, 10) - the server generates an error, says that I have addressed the usual text / plain request to https - ape63

2 answers 2

fsockopen ()

hostname If you are a client of the SSNs, it can be prefixed by the hostname if you are either ssl: // or tls: //

 $hole = fsockopen("ssl://217.ххх.ххх.ххх", 81, $errno, $errstr, 10); 

Of course, OpenSSL must be installed

  • Thanks, OpenSSL is installed on a remote server. Maybe I think wrong in general, now I will formulate it differently: There is a server to which I periodically need to send data in the format below. In the example, everything works, but I don’t know how to make the same call from the script: bertal.ru/… - ape63
  • In the manual on the link above there are a bunch of examples. But apparently you do not need low-level work with sockets. Use better [cURL] [1] And also read about [SOAP] [2] and the corresponding [extension for PHP] [3]. [1]: ru.php.net/curl [2]: ru.wikipedia.org/wiki/SOAP [3]: ru.php.net/manual/en/book.soap.php - Ilya Pirogov
  • Use curl php.net/curl - Alex Kapustin

uh ... you have finally written nonsense. If you want to receive content at this address, use

 file_get_contents("https://217.ххх.ххх.ххх:81/History/HistoryService.asmx"); 

If you need to connect through sockets, then you need to write:

 $hole = fsockopen("217.ххх.ххх.ххх", 81, $errno, $errstr, 10); 
  • fsockopen ("217.xxx.xxx.xxx", 81, $ errno, $ errstr, 10) - the server generates an error, says that I have addressed the usual text / plain request to https - ape63
  • Well Duc, right, I guess. You did not bring the part where you "communicate" with the server, and there is no point in writing so-called "communication" with ssl on the sockets. You tell me why you need it? - Alex Kapustin