I seem to be having a little bit of trouble with executing a nslookup via
PHP's passthr() function.
This:
passthru("nslookup -query=ns testing12345.nl", $returnVar);
Returns:
"Server: ns1.activedomain.nl
Address: 217.148.161.5
Aliases: 5.161.148.217.in-addr.arpa
0"
However, when I execute the nslookup command directly from my SSH client, I
get this result (minus the ---):
---
Server: ns1.activedomain.nl
Address: 217.148.161.5
Aliases: 5.161.148.217.in-addr.arpa
*** ns1.activedomain.nl can't find testing12345.nl: Non-existent host/domain
---
For some reason passthru does not pass back the last line. And that is
exactly the line that I need! I also tried exec(), system() and shell_exec()
But PHP does not give me that last line.
I should mention that I'm on a freeBSD system with Apache 1.3.32 and PHP
4.3.10
Can anyone help me out on this?
Try...
passthru("nslookup -query=ns testing12345.nl 2>&1", $returnVar);
The "2>&1" will send stderr to stdout. My guess is your last line is
stderr.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php