Hi,
I use fopen to get data from a website with different ID number.
for ($count = 1; $count <= 10; ++$count) {
$url="preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);
$domain = " . $matches[2];
$page = $matches[3];
$fd = fopen($domain.$page, "rb"
;
$code = "";
while(!feof($fd)){
$code .= fread($fd, 1000);
}
fclose($fd);
However, I get warning messages and the program will not stop or need to wait for a long long time, if the id is invalid.
How can I bypass the loop if the id in not valid?
Thanks,
Roger
I use fopen to get data from a website with different ID number.
for ($count = 1; $count <= 10; ++$count) {
$url="preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);
$domain = " . $matches[2];
$page = $matches[3];
$fd = fopen($domain.$page, "rb"
$code = "";
while(!feof($fd)){
$code .= fread($fd, 1000);
}
fclose($fd);
However, I get warning messages and the program will not stop or need to wait for a long long time, if the id is invalid.
How can I bypass the loop if the id in not valid?
Thanks,
Roger