Created
January 24, 2019 05:29
-
-
Save ParityError/e39717cd8b1efe6593a8d190dd8eef0a to your computer and use it in GitHub Desktop.
Testing fsockopen with pecl ssl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fp = fsockopen("ssl://pecl.php.net", 443, $errno, $errstr, 30); | |
if (!$fp) { | |
echo "$errstr ($errno)<br />\n"; | |
} else { | |
$out = "GET / HTTP/1.1\r\n"; | |
$out .= "Host: www.example.com\r\n"; | |
$out .= "Connection: Close\r\n\r\n"; | |
fwrite($fp, $out); | |
while (!feof($fp)) { | |
echo fgets($fp, 128); | |
} | |
fclose($fp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment