PHP - Explain how to get the DNS servers of a domain name.

Explain how to get the DNS servers of a domain name.

<?
function get_dns($domain)
{
    $end = substr("$domain",-2);
    if($end==uk)
      {$type=uk;}
    else
      {$type=com;}

    if($type==uk)
      {$lookup="whois.nic.uk";}
    else{$lookup="rs.internic.net";}

    $fp = fsockopen( "$lookup", 43, &$errno, &$errstr, 10);
    fputs($fp, "$domain\r\n");

    while(!feof($fp))
    {
      $buf = fgets($fp,128);
      if (ereg( "Domain servers", $buf))
      {
        {$dns = fgets($fp,128);}
        {$dns .= fgets($fp,128);}
     }
     if (ereg( "Name Server:", $buf))
     {
        {$dns = fgets($fp,128);}
        {$dns .= fgets($fp,128);}
        $dns = str_replace( "Name Server:", "", $buf);
        $dns = str_replace( "Server:", "", $dns);
        $dns = trim($dns);
     }
     }
     Return $dns;
}
?>

Explain how to get the DNS servers of a domain name.

The process is :

- Include the Net/DNS.php file in the beginning of the script
- Create the object for DNS resolver by using $ndr = Net_DNS_Resolver()
- Query the ip address using $ndr->search(“somesite.com”,”A”) and assign to a relevant variable. Ex: $result
- Display the value of $result
PHP - Explain how to mail the content of a form.
Explain how to mail the content of a form - The HTML code can call the samplemail.php page and use the POST method to post the data.....
PHP - Explain how to send large amounts of emails with php.
Explain how to send large amounts of emails with php - The mail() function of PHP is quite robust for sending bulk emails...
Advantages of PHP
PHP advantages - PHP offers a lot of security mechanisms, Its easy connectivity abilities make it a popular choice of modular programming......
Post your comment