Re: testing the validity of a link
| From: | Peter Beckman | Date: | Fri, 21 Feb 2003 17:58:16 +0000 |
| Subject: | Re: testing the validity of a link | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25835@lists.php.net to get a copy of this message | ||
You could do an fopen on the URL and see if the results contain the string
"404 not found" or something. Read these pages:
http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/wrappers.php
http://www.php.net/manual/en/function.stream-get-meta-data.php
Looks like with 4.3+ you can use the internal functions of PHP to do what
you are asking.
You could alternatively install curl and get the resulting HTTP code.
http://www.php.net/manual/en/ref.curl.php
Peter
---------------------------------------------------------------------------
Peter Beckman Internet Guy
beckman@purplecow.com http://www.purplecow.com/
---------------------------------------------------------------------------