开发者

PHP code doesn't work properly

开发者 https://www.devze.com 2023-03-12 08:50 出处:网络
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 :

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 . $arrT开发者_高级运维ext[$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 : www.example.com

Content :

file1.txt Rejected 
file2.txt Accepted


Is this the line you're after?

for ($i=0, $j=count($arrText); $i < $j; $i++) {


You have a syntax error here:

for ($i=0; $i  
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号