(主要用了两个字符串函数implode()和explode) 我制作的域名查询的源代码,主要用了两个字符串函数implode()和explode,利用这两个函数的切割字符串的强大功能,可以查询.com,.net.,org.,cc.,tv下的域名whois。 <?php echo '<center><form>'; echo '<input type="text" name="string">'; echo '<input type="submit" value="查询">'; echo "</form>"; if (isset($string)) { $url = "http://networksolutions.com/cgi-bin/whois/whois?STRING=".$string."&STRING=Search"; $str = implode("",file($url)); $aa= explode("<pr",$str); $bb=$aa[1]; $cc=explode("re>",$bb); $dd= $cc[0]; $ee=explode("e>",$dd); $ff=implode("<pre>",$ee); $hh=explode("</p",$ff); $jj=implode("</pre>",$hh); $kk=explode("Registrant",$jj); $ll=implode("<font color=red>注册人</font>",$kk); $mm=explode("Domain Name",$ll); $nn=implode("<font color=red>域名</font>",$mm); $oo=explode("Administrative Contact",$nn); $pp=implode("<font color=red>管理联系人</font>",$oo); $qq=explode("Technical Contact",$pp); $ii=implode("<font color=red>技术联系人</font>",$qq); $ss=explode("Record last updated on",$ii); $tt=implode("<font color=red>最后更新日期:</font>",$ss); $uu=explode("Record expires on",$tt); $vv=implode("<font color=red>域名到期日期:</font>",$uu); $ww=explode("Record created on",$vv); $xx=implode("<font color=red>域名注册日期:</font>",$ww); $yy=explode("Database last updated on",$xx); $zz=implode("<font color=red>数据库更新日期:</font>",$yy); $aaa=explode("Record updated on",$zz); $bbb=implode("<font color=red>记录更新日期:</font>",$aaa); $ccc=explode("Admin Name",$bbb); $ddd=implode("<font color=red>管理联系人</font>",$ccc); $eee=explode("Tech Name",$ddd); $whois=implode("<font color=red>技术联系人</font>",$eee); } echo '<center><table width="50%" border="0" cellspacing="1" cellpadding="0" bgcolor="#FF6666">'; echo '<tr bgcolor="#ffcc33">'; echo "<td>"; echo '<div align="center">域名whois查询系统</div>'; echo "</td>"; echo "</tr>"; echo '<tr bgcolor="#FFFFFF">'; echo "<td>"; echo '<div align="left">'; echo "<br>"; echo $whois; echo "</div>"; echo "</td>"; echo "</tr>"; echo '<tr bgcolor="#ffcc33">'; echo "<td>"; echo '<div align="center"><a href="http://www.phpcode.net"><font face="Verdana, Arial, Helvetica, sans-serif">PHPcode.net</font></a></div>'; echo "</td>"; echo "</tr>"; echo "</table>"; ?> |