Check Whether a Page is 404 or not Using PHP
- Article
- Comment (2)
Check Whether a Page is 404 or not Using PHP. Here in certain situations we need to know the page it whether 404 or not. Here I have some simple php codes to find it through programmatically. Just use the following code to detect it yourself.
$kv_uri = 'https://www.kvcodes.com/testin-url-for-404-error' ; $kv_res = kv_get_page_title($kv_uri);
The above code will call a function with parameter of our url to check it.
function kv_get_page_title($url){ $handle = curl_init($url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($handle); $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if($httpCode == 404) { return true ; } else { return false; } curl_close($handle); }
The above function will check the web page httpcode. If it returns 404 the error will be returned as true. Else it will return a false info.
if($kv_res == true) { echo ' Yes its 404 Error Page' ; }else { echo ' No its working page'; }
That’s it . here is the full code for your usage.
<?php // Program to check whether a page is 404 page or not. $kv_uri = 'https://www.kvcodes.com/testin-url-for-404-error' ; $kv_res = kv_get_page_title($kv_uri); if($kv_res == true) { echo ' Yes its 404 Error Page' ; }else { echo ' No its working page'; } function kv_get_page_title($url){ $handle = curl_init($url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($handle); $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if($httpCode == 404) { return true ; } else { return false; } curl_close($handle); } ?>
Error
SELECT `comment`
FROM `phpmyadmin`.`pma__column_info`
WHERE db_name = ‘fileeazy’
AND table_name = ”
AND column_name = ‘(db_comment)’
MySQL said: Documentation
#1932 – Table ‘phpmyadmin.pma__column_info’ doesn’t exist in engine
It looks like this is related to phpmyadmin error . Check here to get it