Jump to content

fget has white space


ciber

Recommended Posts

I have tried to look google, but was unable to find anything.

and the search daemon is giving me errors on this site.

 

So, when I am calling lines from a text file, I am getting a problem.

to explain, I will use a # to show were this "white space" is I am getting

 

This is the text file

url.com
url2.com
url3.com

 

when PHP reads the file, and I output it into PHP its reading it like this

url1.com#
url2.com#
url3.com

 

url1.com and url2.com both are getting this "white space" at the end of them, and the last entry does not. I have tried to use str_replace(" ","",$line) and str_replace("\r","",$line) but nothing.

can anyone advise me as to what character this is that is being outputed.

 

my code I'm using

    $f = fopen ("list.txt", "r");
    while ($line= fgets ($f)) {
        if($url == $line){echo $line;}
    }
    fclose ($f);

Link to comment
https://forums.phpfreaks.com/topic/214342-fget-has-white-space/
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.