You are here: Re: [PHP] Nameserver lookup « PHP « IT news, forums, messages
Re: [PHP] Nameserver lookup

Posted by Philip Hallstrom on 06/07/05 17:34

> 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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация