Skip to content

Instantly share code, notes, and snippets.

@DBarney
Last active May 2, 2020 21:10
Show Gist options
  • Save DBarney/4476047 to your computer and use it in GitHub Desktop.
Save DBarney/4476047 to your computer and use it in GitHub Desktop.
<?php
$host = 'pagodabox.com';
$response = "";
if ( $fp = fsockopen("ssl://{$host}", 443, $errno, $errstr, 30) ) {
$msg = 'GET / HTTP/1.1' . "\r\n";
$msg .= 'Host: ' . $host . "\r\n";
$msg .= 'Connection: close' . "\r\n\r\n";
if ( fwrite($fp, $msg) ) {
while ( !feof($fp) ) {
$response .= fgets($fp, 1024);
}
}
fclose($fp);
} else {
$response = false;
}
if ($response == false){
echo($errno);
echo($errstr);
}else{
echo($response);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment