On Wed, 2003-12-31 at 09:39, Bj wrote:
> > From: Steve Miller
>
> > We are setting up an application where users will be
> > entering links into a db, and we need a way to check
> > them to make sure they are good.
>
> Php can open a Web page like opening a file - or not, if the link is no good. So,
> you could experiment with something like:
>
> if (fopen($link, "r")
> # Link is OK - save in database
> else
> # Link not working - reject it
>
how about building on this:
// try and open the link
$file = fopen($link,"r"); // Note if safe mode is on, fopen might not
//open URLs
// Look for a "404" code
eregi($file, "404",$errorCode) // greps the file looks for the text
// "404" and put is into an array
// check to see if the array holds data
if($errorCode) // if this is TRUE, the file does not exist
{
echo "there has been an error";
exit;
}
else
{
// Code to add to database
}
Don't know if this will work, but it's an idea... :)
Regards,
Matt
--
+----------------------------------+
|Matthew Macdonald-Wallace |
|The Truth Will Set you Free |
|http://www.truthisfreedom.org.uk/ |
+----------------------------------+
"For every fatal shooting, there were roughly three non-fatal shootings.
And, folks, this is unacceptable in America. It's just unacceptable. And
we're going to do something about it." George W. Bush May 14, 2001
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]