Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Output of Shell command

Status
Not open for further replies.

Trancemission

Technical User
Oct 16, 2001
108
GB
Hi all,

I am now starting to want to execute shell commands (Ping nsloookup etc) within my PHP scripts.

My _problem_ is the default output is not formatted in anyway. No line breaks etc..

I am not %100 sure on what format my output will be so having trouble trying to format it [did that make sense :)?]

Has anybody got some tips for the popular commands? [ping, tracert]. My text formatting is limited anyways so I am having difficultly from the start.

I have googled for some demo code but I seem to be getting nowhere, maybe I am having one of thise days.

Many Thanks Trancemission
=============
If it's logical, it'll work!
 
These functions do return output that is (somewhat) formatted. But if you output it to an HTML page, your browser ignores the newlines.

Are you sending your output to the browser inside <pre>...</pre> tags?

Even without the <pre> tags, if you perform a &quot;view source&quot; in your browser, you should then see the newlines. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top