What is the best way to check if a URL exists in PHP?

You can use get_headers($url) Example 2 from Manual: <?php // By default get_headers uses a GET request to fetch the headers. If you // want to send a HEAD request instead, you can do so using a stream context: stream_context_set_default( array( ‘http’ => array( ‘method’ => ‘HEAD’ ) ) ); print_r(get_headers(‘http://example.com’)); // gives Array ( … Read more