|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-05-15 19:01 UTC] wez@php.net
[2003-07-25 08:38 UTC] iliaa@php.net
[2003-07-29 07:25 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
stream_set_timeout() doesn't seem to work when using fsockopen("ssl://<some host here", 443, $errno, $errstr); My example code In my real test I am using an web server on my net that does some processing in a script and over time spits me back info. This script shows a test calling www.verisign.com in ssl:// mode and non ssl mode. I never the timeouts when using ssl://, but I do when using non-ssl fsockopen connections. <?php $url = "/"; $scan_host = "www.verisign.com"; //$fp = fsockopen("ssl://".$scan_host, 443, $errno, $errstr, 5); $fp = fsockopen($scan_host, 80, $errno, $errstr, 5); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { $header = "GET ".$url." HTTP/1.0\r\nHost: ".$scan_url."\r\n"; $header .= "Connection: close\r\n\r\n"; fputs ($fp, $header); stream_set_timeout($fp, 0,500); $keep_alive = time(); while (!feof($fp)) { $str = fgets ($fp,1024); if (strlen($str) > 0) { echo "got '$str'<br>"; } $stream_info = stream_get_meta_data( $fp ); if ($stream_info["timed_out"]) { //the stream timed out echo "KEEP-ALIVE<br>"; } if (time() - $keep_alive >= 30) { echo "keep-alive<br>"; $keep_alive = time(); } } fclose ($fp); } ?>