Jump to content

function url_exists($url)


drisate

Recommended Posts

Hey guys i need to teste if an image exists or not ... and my function returns true what ever i put in it ...

 

    function url_exists($url) { 
        $hdrs = @get_headers($url); 
        return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false; 
    } 

 

The function needs to be as faste as possible because it has to teste 300 jpg image on page load

Link to comment
https://forums.phpfreaks.com/topic/180308-function-url_existsurl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.