Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing fsockopen with pecl ssl
$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