Page 1 of 1

Checking Links with php code

Posted: Sat Jun 10, 2006 11:20 pm
by SteveD
I would like to make a php program that will take a list of URLs in all of my site's web pages and somehow "ping" (for lack of a better word) each site and return a value if they are still active.

I've seen services on the web that do this but there is always some shortcoming on them that I would like to fix. I have several books on php but honestly I don't even know where to begin for something like this. It must be possible. What commands should I start to look at (and learn about)?

TIA
Steve

Posted: Sun Jun 11, 2006 12:02 am
by feyd
php 5 has get_headers(), and you can use curl in php 4 to do the same thing, or fsockopen() if you're feeling daring.

Posted: Sat Jun 17, 2006 12:16 am
by anjanesh
Just for pinging, wouldnt gethostbyname do the job ?

Posted: Sat Jun 17, 2006 12:19 am
by feyd
anjanesh wrote:Just for pinging, wouldnt gethostbyname do the job ?
That would do a DNS lookup, not touch the server.

Posted: Sat Jun 17, 2006 12:20 am
by tecktalkcm0391
Yeah I think it would if all the links were in an array, and then if you do a for() statement with that it would work, I might be slow, but it would work.