URL Checking

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
gopher
Forum Newbie
Posts: 1
Joined: Sat Jul 24, 2004 4:44 am

URL Checking

Post by gopher »

I've made a script where a user can add an image (or image information rather) to a database.

Now what I need to know, is if there is a way that I can check that an entered URL actually exists, I don't want them to be able to link to an image that does not exist.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Perhaps the following might be of use. Tweak and add more to fit your solution.

Code: Select all

<?php
    if($foo = @getimagesize('http://forums.devnetwork.net/templates/subSilver/images/logo_phpBB.gif')) {
        echo '<pre>';
        print_r($foo);
        echo '</pre>';
    }
?>
Post Reply