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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drops < > brackets when displaying returned output

Status
Not open for further replies.
Aug 14, 2008
38
US
Running a fairly simple script but not sure how to get the script to display the missing data encapsulated between the < > brackets. I would like to have the page display the results as returned.



Expected results

Apr 18 23:20:25 isp.com postfix/local[4431]: [ID 197553 mail.info] BAD854989F: to=<name@isp>, orig_to=<name@isp>, relay=local, delay=0.49, delays=0.1/0.01/0/0.39, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 18 23:39:03 isp.com postfix/local[11497]: [ID 197553 mail.info] AB1B545964: to=<name@isp>, orig_to=<name@isp>, relay=local, delay=0.49, delays=0.1/0.01/0/0.38, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 19 00:11:04 isp.com postfix/local[21399]: [ID 197553 mail.info] 001A245E12: to=<name@isp>, orig_to=<name@isp>, relay=local, delay=0.48, delays=0.1/0.01/0/0.37, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 19 00:15:11 isp.com postfix/local[21041]: [ID 197553 mail.info] 45D6A45EBC: to=<name@isp>, orig_to=<name@isp>, relay=local, delay=0.47, delays=0.1/0.01/0/0.37, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")

As output is displayed in the web it drops the <> information such as to= from=

Apr 18 23:07:17 isp.com postfix/local[21319]: [ID 197553 mail.info] DA43D45541: to=, relay=local, delay=0.22, delays=0.13/0.01/0/0.08, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 18 23:11:03 isp.com postfix/local[4619]: [ID 197553 mail.info] 2701449729: to=, orig_to=, relay=local, delay=0.5, delays=0.1/0.01/0/0.4, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 18 23:20:25 isp.com postfix/local[4431]: [ID 197553 mail.info] BAD854989F: to=, orig_to=, relay=local, delay=0.49, delays=0.1/0.01/0/0.39, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 18 23:39:03 isp.com postfix/local[11497]: [ID 197553 mail.info] AB1B545964: to=, orig_to=, relay=local, delay=0.49, delays=0.1/0.01/0/0.38, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 19 00:11:04 isp.com postfix/local[21399]: [ID 197553 mail.info] 001A245E12: to=, orig_to=, relay=local, delay=0.48, delays=0.1/0.01/0/0.37, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")
Apr 19 00:15:11 isp.com postfix/local[21041]: [ID 197553 mail.info] 45D6A45EBC: to=, orig_to=, relay=local, delay=0.47, delays=0.1/0.01/0/0.37, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -a "$EXTENSION")

PHP script

Code:
<?php
$output = shell_exec('grep name@isp /archive/isp/tools/log/maillog.0');
echo "<pre>$output</pre>";
?>



 
Hi

I strongly believe there is nothing dropped and if you take a look at the page's HTML source, all those characters are in place.

Text between less than ( < ) and greater than ( > ) characters is interpreted as HTML tag, which in your output's case is an invalid one, so ignored in the rendered output.

To not have them interpreted as part of the HTML markup use [tt]htmlentities()[/tt] or [tt]htmlspecialchars()[/tt] to transform them into [tt]<[/tt] and [tt]>[/tt] character entities :
Code:
echo "<pre>",htmlentities($output),"</pre>";


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top