nslookup in PHP
<?php
if(!filter_input( INPUT_GET, "domain" ))
{
die("Not found");
}
$search = filter_input( INPUT_GET, "domain" );
// GHOST脆弱性対策
// http://blog.tokumaru.org/2015/02/ghostphp.html
if(strlen($search)>255)
{
die("Not found");
}
if(!gethostbynamel($search))
{
die("Not found");
}
$ips = gethostbynamel($search) ;
// output
header("Content-Type: text/plain; charset=utf-8");
foreach($ips as $value)
{
echo $value."\n";
}