Checks if URL exists

Uses get_headers() to check if URL exists. Read more.

php
fork add to bundle source
function url_exists($url) { $headers = @get_headers($url); if(!$headers || strpos($headers[0], '404 Not Found') !== false ) { return false; } else { return true; } }

usage

load_function('url_exists'); echo url_exists('https://example.com/'); // 1
← how to use this in app?
create log ...inout