Skip to content

Instantly share code, notes, and snippets.

@thinsoldier
Last active May 11, 2016 19:45
Show Gist options
  • Save thinsoldier/b842f2617034e2427d88c9752578b060 to your computer and use it in GitHub Desktop.
Save thinsoldier/b842f2617034e2427d88c9752578b060 to your computer and use it in GitHub Desktop.
<?php
$statusArray = array();
$allURLs = array("https://kat.cr/usearch/life%20of%20pi/","https://en.wikipedia.org/wiki/Basketball","https://kat.cr/usearch/life%20of%20pi/","https://en.wikipedia.org/wiki/Basketball");
foreach( $allURLs as $key => $value )
{
$handle = fopen( $value, "r");
if ($handle)
{
$statusArray[] = "able to open the page!";
}
else
{
// error opening the file.
$statusArray[] = "404";
}
/* printing first line of page now */
$line = fgets($handle);
echo "\n first line: ".$line."\n";
fclose($handle);
}
print_r($statusArray);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment