404 pages can be found with php, but I have 200 return urls, as I have validated the URL , But when they say something like this: "This file does not exist, access to the following file is limited or removed due to copyright infringement." I want to validate a page where some Files are no longer available. Some examples:
-
And my PHP code is:
$ ch = Curl_init ("depositfiles.org/files/r0flcxpwp"); Curl_setopt ($ CH, CURLOPT_FAILONERROR, true); Curl_exec ($ ch); $ Url_status = curl_getinfo ($ CH, CURLINFO_HTTP_CODE); If ("404" == $ estatus_url) {resonant "do something"; `} Curl_close ($ ch);
You will need to search the webpage for a specific word because most sites do not Are a 404 code.
function chk_error ($ a) {// List of error messages $ file_error = array ("this file does not exist", "file not found"); Foreign Currency ($ file $ as file type inside $$) {$ findme = strrpos ($ a, $ v); If ($ findme === incorrect) {$ err = 1; } And {$ err = 2; break; }} Return $ mistake; } $ Ch = curl_init ("http://dfiles.eu/files/r0flcxpwp"); Curl_setopt ($ CH, CURLOPT_FAILONERROR, true); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); $ Page_content = curl_exec ($ ch); $ Url_status = curl_getinfo ($ CH, CURLINFO_HTTP_CODE); If ("404" == $ url_status) {"echo" something; } Otherwise (chk_error ($ page_content) == 2) {"Echo something"; } Else {echo ":)"; } Curl_close ($ ch);
No comments:
Post a Comment