Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Using file socket to read a page
<?php
/**
* Using file socket to read a page
* Sample from internet
*/
$fp = fsockopen ("slashdot.org", 80);
if ($fp)
{
fwrite($fp, "GET / HTTP/1.1\r\nHOST: slashdot.org\r\n\r\n");
while (!feof($fp))
{
highlight_string(fread($fp,256));
}
fclose ($fp);
} else
{
print "Fatal error\n";
}
?>
@phpfiddle
Owner

Phpfiddle.org sample file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment