LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2012, 04:23 PM   #1
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,613

Rep: Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884
Remove linefeed from php read by conky.


I am sure this is just my ignorance but I am struggling to find a way around this.
I want to display my external IP in conky so I have it read a page on my website. The problem is that the page has a linefeed I don't want.
The webpage is:
Code:
<?php
echo $_SERVER['REMOTE_ADDR'];
?>
and the conky entry is:
Code:
External IP: ${curl mysite.com/ip/ 60}
I know it's something simple I'm missing but I feel the only way I would correct this is to introduce more complexity when what I need is less.
 
Old 05-26-2012, 07:55 PM   #2
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946
I think it is the newline after the ?>.

Are you sure you don't have an extra newline (possibly after some whitespace) at the end of the file?

I guess easiest would be to save the PHP file without newlines, for example by saving the PHP file using command
Code:
printf '<?php echo $_SERVER[\047REMOTE_ADDR\047]; ?>' > filename.php
Note that if you edit the file, most editors will add a newline at end for you automatically.
 
Old 05-26-2012, 08:13 PM   #3
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,613

Original Poster
Rep: Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884Reputation: 1884
Thank you, it was a stray newline at the end of the PHP file.
I had become too used to ignoring whitespace. Apologies for the laziness of my question but I don't think I would have realised it was due to whitespace in a year of googling.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Configure conky-Lua in Ubuntu (11.10 & 12.04), Fedora, debian and LinuxMint | Howto Conky LXer Syndicated Linux News 0 03-06-2012 12:40 PM
LXer: Conky Colors Makes Your Conky Beautiful In Seconds (Version 3.20 Released) LXer Syndicated Linux News 0 08-01-2010 11:21 AM
[SOLVED] Configuring Conky to read log file entries - apache + fail2ban djsmiley2k Linux - Desktop 1 04-26-2010 04:29 AM
How to read the content of a file with conky Adso Linux - Newbie 5 05-17-2009 09:33 AM
Teach me about conky and linux resource management... How do I read load? CPU avg? Mysticle31 Linux - Software 1 12-15-2007 06:18 PM


All times are GMT -5. The time now is 06:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration