LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
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: 7,680

Original Poster
Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:10 PM.

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
Open Source Consulting | Domain Registration