i’ve recently started to use php and i am trying to load the content of a website that has a list of file names with (.txt)format.Moreover, i have created a function :
<?php
//--------------------------
// The function itself
//--------------------------
function LoadSource($siteurl) {
$arrText = file($siteurl);
for ($i=0; $i<count($arrText); $i++) {
$pos = strpos($text . $arrText[$i], "+CUSERR+");
if ($pos !== false) {
echo "The string +CUSERR+ was found in the string";
$text = $text . $arrText[$i]." ==> REJECTED";
} else {
echo "The string +CUSERR+ was not found in the string";
$text = $text . $arrText[$i]." ==> ACCEPTED";
}
}
return $text;
}
$source = loadSource("http://www.example.com");
echo $source;
?>
what i am trying to do is, First to load the content of that website and then display (Rejected) Beside the txt file name that has (CUSERR) word in it or (Accepted) beside the txt file name that has (CUSACK) word.
Example :
Url : http://www.example.com
Content :
file1.txt Rejected file2.txt Accepted
Is this the line you’re after?