Re: system command
| From: | Ronald Wiplinger | Date: | Fri, 26 Oct 2007 02:00:19 +0000 |
| Subject: | Re: system command | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263680@lists.php.net to get a copy of this message | ||
Instruct ICC wrote:
I still have a problem with it. It prints the info to the page. Can I suppress this somehow? bye RonaldDate: Thu, 25 Oct 2007 09:43:14 +0800 From: ronald@elmit.com To: php-general@lists.php.net Subject: [PHP] system command I tried: $a=$_SERVER["REMOTE_ADDR"]; echo "<p>REMOTE_ADDR=$a<br>"; if($a="192.168.250.108") {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.$a="61.64.101.101";} $aa=system('lynx -dump http://api.hostip.info/country.php?ip=$a',$location); echo "<p>a=$a<br>aa=$aa<br>location=$location<br>"; $aa=system('lynx -dump http://api.hostip.info/country.php?ip=61.64.101.101',$location); echo "<p>a=$a<br>aa=$aa<br>location=$location<br>"; I get: REMOTE_ADDR=192.168.250.108 XX a=61.64.101.101 aa=XX location=0 TW a=61.64.101.101 aa=TW location=0 as you can see, if I put the IP address in, I get the right answer (TW). What am I doing wrong? bye Ronald