Last active
May 11, 2016 19:45
-
-
Save thinsoldier/b842f2617034e2427d88c9752578b060 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?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