Re: checking if URL's exist
| From: | Daniel Brown | Date: | Wed, 09 Jul 2008 15:35:09 +0000 |
| Subject: | Re: checking if URL's exist | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276506@lists.php.net to get a copy of this message | ||
On Wed, Jul 9, 2008 at 6:18 AM, <cr.vegelin@gmail.com> wrote:
> Hi All,
>
> I have a Directory table with hundreds of URL's to sites
> and want to check periodically if all the URL's still exist.
> Does anyone know of a utility to check this ?
> Or a pointer to a piece of code ...
>
> TIA, Cor
>
<?php
// $urls = Your array of URLs
foreach($urls as $u) {
if(file_get_contents($u)) {
echo $u." appears to exist.\n";
} else {
echo $u." does not appear to exist.\n";
}
}
?>
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.