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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.