<?php
function isPartOfString($fileURL)
{
$getHeaders = @get_headers($fileURL);
$str = $getHeaders[0];
// 200 is the response code in the very first line of the headers when some file is found.
// 3rd param starts search after HTTP/1
$pos = strpos($str, ' 200 ', 5); // Note the space before and after 200
// Note: The !== operator should be used below.
// Using != would not work as expected some times, e.g,
// if the position of second param in the $str is 0 then statement (0 != false) evaluates
//to false, though it was found....so take care of context also while forming conditions
if ($pos !== false) {
// now we can be sure that the func strpos returned something not in boolean context
//returned pos is irrestive of offset
if($pos > 5)
{
echo "File found";
}
}
else {
//echo "The string '$findme' was not found in the string '$mystring'";
echo "File not found";
}
}
?>