Re: system command
| From: | Ronald Wiplinger | Date: | Sat, 27 Oct 2007 02:55:05 +0000 |
| Subject: | Re: system command | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263743@lists.php.net to get a copy of this message | ||
Instruct ICC wrote:
I have within a web page: <?php $a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa); ?> <H1> ..... later I pickup the variable $a again ... The problem for me is that the line $a=system('/usr/bin/lynx -dump http://api.hostip.info/country.php?ip='.$aa); prints (before <H1>) the result ($a). I need the variable within the program, but do not want to display it. It seems that 'system' includes an 'echo' bye Ronaldman lynx ? I don't use lynx and I don't know what you mean by "info to the page". I tried lynx -dump http://www.google.com to try to see what you mean. Maybe something to do with the last line (but I get several lines) Return Values Returns the last line of the command output on success, and FALSE on failure.Use double quotes to get the value of $a or else you get the literal string "$a". $aa=system("lynx -dump http://api.hostip.info/country.php?ip=$a",$location); or $aa=system('lynx -dump http://api.hostip.info/country.php?ip='.$a,$location);Thanks! 1st solution did not work for me, but the second one did. I still have a problem with it. It prints the info to the page. Can I suppress this somehow?