Jump to content

Still having problems with stripos


unknown101

Recommended Posts

Hello guys, ive got the following snippet of my code..using the snoopy class (which i have double checked outputs the correct results)

 


$fh = fopen($myFile, "r");
$line = fgets($fh);

$snoopy->fetchtext("http://www.domain.com");
    $source = $snoopy->results;

if ( stripos($source, $line) )
echo 'The website grabbed has '. $line .' in it';

else 
{
echo '  The keyword has not been found';
}


 

The code above only works if I manually set the variable $line to a value.  For example if i set $line = searchWord, knowing that word is in the website it will find it no problem (and if i deliberately set a word that isnt in the website it will return not found).  So this suggests the actual functions works fine.

When I read in a line from a txt file and then search for this it doesnt find it?! (As above)

 

I have echo'ed the value which has been read in from the file and it works fine.  I can set the a variable to the same as what is read in from the text file and output both values, they appear exactly the same in  a browser.. just that the value from the text file will not work in the function?!  Does anyone have any idea what could be causing this or if im making a silly mistake?

 

Any suggestions appreciated..

 

Thanks in advance

 

Link to comment
https://forums.phpfreaks.com/topic/103007-still-having-problems-with-stripos/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.