$headers = get_headers('http://site.com/url.html'); if(strstr($headers[0],'404')) echo '404 ile sonlandi';