for($x=0; $x<count($links); $x++) {
$fp2 = @fopen($links[$x],"r");
if (!$fp2) {
echo "$links[$x] is not a valid URL<br>";
}
else {
här händer lite grejjer..
}
}
Om värdena i arrayen $links är fungerande länkar fungerar perfekt. Men om
Tror inte att problemet ligger i din kod! fopen mot URL:ar fungerar helt enkelt kass om det är så att sidan du laddar från är nere eller inte finns.
Från manualen
Indeed, the fopen-wrappers aren't written too well - they might easily force your server its knees if the server you're connecting to is encountering problems.
You could try the CURL support that is in the CVS version, or write your own HTTP implementation either within the fopen-wrappers yourself in C, or try using the fsockopen in PHP and do it within PHP with sockets. With fsockopen, you would connect to port 80 or whichever is running the WWW server) in the server you wish to request the page, send a 'GET /URI HTTP/1.[01]' with whatever headers you need, and then parse the headers and the content.]