[SOLVED] checking if a url exists

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sh33p1985
Forum Commoner
Posts: 78
Joined: Thu Mar 11, 2004 9:22 am

[SOLVED] checking if a url exists

Post by sh33p1985 »

after stripping all the links from a webpage and again stripping the hrefs from the links and storing them in an array. i want to check to see if the urls exist (they are absolute) and if not echo "href doesnt exist" and echo "href does exist" if they do. how can in do this?
sh33p1985
Forum Commoner
Posts: 78
Joined: Thu Mar 11, 2004 9:22 am

Post by sh33p1985 »

also, im having problems with file_get_contents("http://etc");
get an error message when calling the function:

Fatal error: Call to undefined function: file_get_contents

anyone know why this is?
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

sh33p1985 wrote: Fatal error: Call to undefined function: file_get_contents
Sounds like you might be on an older version of PHP. file_get_contents was introduced in 4.0. I believe you can see your version and other stuff by saying:

print (php_info());

You will probably need to look into using fopen:

http://www.php.net/fopen
sh33p1985
Forum Commoner
Posts: 78
Joined: Thu Mar 11, 2004 9:22 am

Post by sh33p1985 »

nah its 4.2.3, works on me mates machine but not on mine. strange
Post Reply