SUSE Linux iTOps Tube

Wednesday, May 9, 2012

php dns_get_record is not working

guys, I have followed the php man page but failed to able to buildup the form where I can take a domain name and an lookup type and then can use the dns_get_record func in php for the dns lookup. Basically I was looking for a dnsstuffs.com type tool for my LAN. Now, here is the code so that you guys can understand where I made the mistake...


Code:


<?php

        $query = '';

        $domain = '';

        $type = '';

        $record = '';

        if(isset($_POST['txtDomain']))

                                {

                                        $domain = $_POST['txtDomain'];

                                        $type = $_POST['optType'];

                                        $query = dns_get_record($domain, $type);

                                        sort($query);

                                }

?>



<html>



<head>





<!--mstheme--><link rel="stylesheet" href="../gifs/bloc1111.css">

</head>



<body>



<div align="center">

<table border="0" cellpadding="6" cellspacing="0" width="900">

  <tr>

    <td width="100%">

<?php include 'pageheader.php';?>

<hr>

<?php include 'topnav.php';?>

<hr>

<table width="100%"  border="0" cellspacing="0" cellpadding="6">

  <tr>

    <td width="20%" valign="top"><?php include 'leftsidenav.php';?><br>

        </td>

    <td width="60%" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="6">

      <tr>

        <td align="center"><strong><font size="2"><font color="#FF0000">banglar</font><font color="#008000">damal</font> - Internet Tools &gt; DNS Lookup </font></strong></td>

      </tr>

    </table>

        <hr>

        <table width="100%"  border="0" cellspacing="0" cellpadding="6" style="font-size:12px">

          <tr>

            <td><div align="justify">

              <p>This tool will help you to find out DNS related information about a Domain. The tools is simple and straight forward. </p>

                        </div></td>

          </tr>

        </table><hr>

        <table width="100%"  border="0" cellspacing="0" cellpadding="6" style="font-size:12px">

  <tr>

        <form name="frmDNS" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">

          <td valign="top">Enter the domain:&nbsp;

          <input type="text" name="txtDomain">&nbsp;and lookup type:

          <select name="optType">

                  <option value="DNS_A">A</option>

                <option value="DNS_MX">MX</option>

                <option value="DNS_NS">NS</option>

                <option value="DNS_PTR">PTR</option>

                <option value="DNS_INFO">INFO</option>

                <option value="DNS_CNAME">CNAME</option>

                <option value="DNS_SOA">SOA</option>

          </select><br><br>

          <input name="btnLookup" type="submit" value="Lookup">&nbsp;<input type="reset" name="btnReset" value="Reset">

        </td></form>

  </tr>

        </table><hr>

        <table width="100%"  border="0" cellspacing="0" cellpadding="6" style="font-size:12px">

  <tr>

    <td valign="top"><div align="justify">

                <p><strong>Result:</strong></p>

                <p>

                        <?php

                               

                                foreach ($query as $record)

                                {

                                        echo $record['host']."<br/>";

                                        echo $record['type']."<br/>";

                                        echo $record['target']."<br/>";

                                }

                        ?>

                </p>

        </div></td>

  </tr>

        </table>

        </td>

    <td width="20%" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="6" style="border: 1 solid">

      <tr>

        <td align="center" valign="top">Our Sponsors:<hr></td>

      </tr>

      <tr>

        <td align="center" valign="middle"><a href="http://www.nurealahee.com" target="_blank"><img src="../gifs/NEAB-logo.gif" width="78" height="78" border="0"></a></td>

      </tr>

    </table>

        <br>

        <table width="100%"  border="0" cellspacing="0" cellpadding="6" style="border: 1 solid">

      <tr>

        <td align="center" valign="top">Advertise:</td>

      </tr>

      <tr>

        <td align="center" valign="middle">[space to-let]</td>

      </tr>

    </table><br>

        <table width="100%"  border="0" cellspacing="0" cellpadding="6" style="border: 1 solid">

          <tr>

            <td align="center">Free SSL<hr></td>

          </tr>

          <tr>

            <td valign="top"><p align="justify"><font size="2">Get your SSL certificates from <font color="#FF0000">banglar</font><font color="#008000">damal</font> CA for free. <em>(Read more)</em></font></p></td>

          </tr>

        </table><br>

        <table width="100%"  border="0" cellspacing="0" cellpadding="6" style="border: 1 solid">

          <tr>

            <td align="center">Advertise<hr></td>

          </tr>

          <tr>

            <td valign="top"><p align="justify"><font size="2">Space for rental </font></p></td>

          </tr>

        </table>

        </td>

  </tr>

</table>

<hr>

<table border="0" cellpadding="6" cellspacing="0" width="100%" style="font-size:12px">

  <tr>

    <td width="100%"><div align="center"><a href="../comments.php">Comments &amp; Suggestions</a>  | <a href="../site_map.php">Site Map</a> | <a href="../contact.php"> Contact us</a> | <a href="../search.php">Search</a></div></td>

  </tr>

</table>

<hr>

<?php include 'pagefooter.php';?>

</td>

  </tr>

</table>

</div>



</body>



</html>


can somebody tell me where i made the mistake??











1 comment: