{"id":44052,"date":"2020-02-27T08:36:20","date_gmt":"2020-02-27T00:36:20","guid":{"rendered":"http:\/\/4563.org\/?p=44052"},"modified":"2020-02-27T08:36:20","modified_gmt":"2020-02-27T00:36:20","slug":"%e9%80%9a%e8%bf%87php%e4%bb%a3%e7%a0%81%e8%bf%9b%e8%a1%8c%e5%9f%9f%e5%90%8d%e6%8a%a2%e6%b3%a8%e7%9a%84%e6%8a%80%e6%9c%af%e8%b5%84%e6%96%99%e5%88%86%e4%ba%ab","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=44052","title":{"rendered":"\u901a\u8fc7PHP\u4ee3\u7801\u8fdb\u884c\u57df\u540d\u62a2\u6ce8\u7684\u6280\u672f\u8d44\u6599\u5206\u4eab"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>liuliuliu<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:39:36\t<\/p>\n<h3>\u901a\u8fc7PHP\u4ee3\u7801\u8fdb\u884c\u57df\u540d\u62a2\u6ce8\u7684\u6280\u672f\u8d44\u6599\u5206\u4eab<\/h3>\n<p>  \t\t\u6570\u5929\u524d\uff0c\u6211\u66fe\u7ecf\u53d1\u5e16\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u901a\u8fc7\u57df\u540d\u62a2\u6ce8\u53d1\u8d22\u7684\u4e1a\u52a1\u6d41\u7a0b\uff0c\u670b\u53cb\u4eec\u53cd\u5e94\u70ed\u70c8\uff0c\u6709\u4eba\u52a0\u6211\u95ee\u54ea\u91cc\u6709\u76f8\u5173\u62a2\u6ce8\u4ee3\u7801<\/p>\n<p>  \u5c31\u50cf\u5e16\u5b50 https:\/\/www.hostloc.com\/thread-613066-1-1.html \u8bf4\u7684\uff0c\u57df\u540d\u62a2\u6ce8\u9700\u8981\u4ee3\u7801\u7684\u4e3b\u8981\u662f\u4e24\u4e2a\u5730\u65b9 1.\u67e5\u8be2 whois 2.\u63d0\u4ea4api<\/p>\n<p>  \u7b2c\u4e8c\u70b9 \u63d0\u4ea4api\u7684\u4ee3\u7801\uff0c\u8fd9\u4e2a\u4e3b\u8981\u5f97\u6839\u636e\u670d\u52a1\u5546\u63d0\u4f9b\u7684api\u6587\u6863\u8fdb\u884c\u7f16\u7a0b<\/p>\n<p>   hexonet \u7684API\u6587\u6863\u5730\u5740 https:\/\/github.com\/hexonet\/hexonet-api-documentation\/blob\/master\/API\/DOMAIN\/ADDDOMAIN.md <\/p>\n<p>  \u4e5f\u6709\u7a0b\u5e8f\u5458\u4e3a hexonet \u7684api\u63a5\u53e3\u63d0\u4f9b\u4e86\u4e00\u4e2aPHP\u6e90\u7801 https:\/\/github.com\/al-one\/hexonet-api<\/p>\n<p>  dynadot.com \u7684\u62a2\u6ce8API\u5730\u5740 https:\/\/www.dynadot.com\/domain\/api2.html \uff0c\u5b83\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u8981\u4e00\u4e2aget \u6216\u8005post \u5230\u4e00\u4e2a\u5730\u5740 https:\/\/api.dynadot.com\/api2.html?key=8S7I2s6Qd8g&amp;command=register&amp;domain=mydomain.com&amp;duration=1<\/p>\n<p>  quyu.net \u4e5f\u6709API\u63a5\u53e3\uff0c\u8fd9\u4e2a\u8981\u5411\u8da3\u57df\u5ba2\u670d\u7533\u8bf7\uff0cAPI PHP \u793a\u4f8b\u4ee3\u7801 https:\/\/www.quyu.net\/knowledgebase.php?action=displayarticle&amp;id=23<\/p>\n<p>  \u5173\u4e8e\u7b2c\u4e00\u70b9\uff0c\u901a\u8fc7PHP\u4ee3\u7801\u67e5\u8be2whois\u7684\u65b9\u5f0f\u4e3b\u8981\u6709\u4e24\u4e2a 1.CURL 2.SOCKET \u4e0b\u9762\u5c31\u662f\u76f8\u5173\u4ee3\u7801<\/p>\n<p>  CURL<\/p>\n<p>  const TIMEOUT = 30;<br \/>  const PORT = 43;<br \/>  const ESTR = &#8216;Domain not found&#8217;;<br \/>  function whois(string $domain, string $address): array<br \/>  &nbsp; &nbsp; {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$curl = null;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$output = &#8221;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$info = array();<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;if (!function_exists(&#8216;curl_version&#8217;)) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;trigger_error(&#8216;cURL is not found!&#8217;);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;} else {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$curl = curl_init();<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_URL, $address);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_PORT, PORT);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_TIMEOUT, TIMEOUT);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $domain . &quot;rn&quot;);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$output = curl_exec($curl);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;curl_close($curl);<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$info[&#8216;domain&#8217;] = $domain;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(strstr($output, ESTR)) ? $info[&#8216;status&#8217;] = 0 : $info[&#8216;status&#8217;] = 1;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(strstr($output, ESTR)) ? $info[&#8216;description&#8217;] = &#8216;\u6389\u5566,\u8d76\u7d27\u62a2\u5427&#8217; : $info[&#8216;description&#8217;] = &#8216;\u5367\u69fd,\u8fd8\u6ca1\u6389&#8217;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$info[&#8216;whois&#8217;] = $output;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;return($info);<br \/>  &nbsp; &nbsp; }<br \/>  print_r(whois(&#8216;a.dog&#8217;,&#8217;whois.nic.dog&#8217;));<\/p>\n<p>  SOCKET<\/p>\n<p>  const TIMEOUT = 30;<br \/>  const PORT = 43;<br \/>  const ESTR = &#8216;Domain not found&#8217;;<br \/>  function whois(string $domain, string $address): array<br \/>  &nbsp; &nbsp; {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$output = &#8221;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$info = array();<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$connection = fsockopen($address, PORT, $errno, $errmessage, TIMEOUT);<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;if (!$connection) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;echo(&#8216;Connection failed! &#8216; . &#8216;Error no: &#8216; . $errno . &#8216; Error message: &#8216; . $errmessage);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;exit();<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;} else {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;($connection) ? fputs($connection, $domain . &quot;rn&quot;) : $connection = null;<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;if (!is_null($connection)) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; while (!feof($connection)) $output .= fgets($connection);<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$info[&#8216;domain&#8217;] = $domain;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(strstr($output, ESTR)) ? $info[&#8216;status&#8217;] = 0 : $info[&#8216;status&#8217;] = 1;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(strstr($output, ESTR)) ? $info[&#8216;description&#8217;] = &#8216;\u6389\u5566,\u8d76\u7d27\u62a2\u5427&#8217; : $info[&#8216;description&#8217;] = &#8216;\u5367\u69fd,\u8fd8\u6ca1\u6389&#8217;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$info[&#8216;whois&#8217;] = $output;<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;} else {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; trigger_error(&#8216;$connection variable is null!&#8217;);<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; exit();<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;fclose($connection);<\/p>\n<p>  &nbsp; &nbsp;&nbsp; &nbsp;return($info);<br \/>  &nbsp; &nbsp; }<br \/>  print_r(whois(&#8216;a.dog&#8217;,&#8217;whois.nic.dog&#8217;));<\/p>\n<p>  \u7136\u540e\u4f60\u627e\u5230\u4e00\u4e2a\u5b9a\u65f6\u4efb\u52a1\u7684\u811a\u672c\uff0c\u4ee5\u4e00\u5b9a\u7684\u95f4\u9694\u6267\u884cPHP\u4ee3\u7801\u67e5\u8be2whois\u670d\u52a1\u5668\uff0c\u5f53\u53d1\u73b0\u67d0\u4e2a\u57df\u540d\u6389\u4e86\uff0c\u7acb\u523b\u6267\u884c\u57df\u540d\u6ce8\u518cAPI\u5373\u53ef<\/p>\n<p>  \u6700\u540e\u795d\u5927\u5bb6\u9a6c\u5230\u6210\u529f\uff0c\u8d22\u6e90\u6eda\u6eda<\/p>\n<p>  :lol :handshake \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u79d8\u5bc6<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:44:19\t<\/p>\n<p>  \t\t\t\t\t<strong>liuliuliu<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:48:12\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u79d8\u5bc6 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:44<br \/>  \u771f\u6b63\u7684\u597d\u57df\u540d\u90fd\u8981\u7ade\u4ef7\uff0c\u54ea\u8f6e\u5f97\u5230\u81ea\u5df1\u62a2\u4f4f<\/p>\n<p>  \u6211\u8fd9\u91cc\u4e3b\u8981\u662f\u9488\u5bf9\u975e\u4e3b\u6d41\u51b7\u95e8\u540e\u7f00\uff0c\u4e3b\u6d41\u7684 com net org \u6ca1\u60f3\u8fc7\u8981\u81ea\u5df1\u62a2\uff0c\u5c31\u50cf\u5f53\u5e74\u6389\u7684 com.ax tom.cat \u8fd9\u79cd\uff0c\u90fd\u662f\u53ef\u4ee5\u901a\u8fc7\u81ea\u5df1\u7684\u6280\u672f\u624b\u6bb5\u6084\u6084\u62a2\u6ce8\u7684\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>lyhiving<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:49:59\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6700\u5feb\u7684\u63a5\u53e3\u8fd8\u662fenom\uff0c\u8fd8\u662f\u4e56\u4e56\u5f00\u4e2a\u6839API\u8d26\u53f7\u5427\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>liuliuliu<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:51:03\t<\/p>\n<h3><\/h3>\n<p>  \t\tlyhiving \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:49<br \/>  \u6700\u5feb\u7684\u63a5\u53e3\u8fd8\u662fenom\uff0c\u8fd8\u662f\u4e56\u4e56\u5f00\u4e2a\u6839API\u8d26\u53f7\u5427<\/p>\n<p> enom\u6ca1\u7528\u8fc7\uff0c\u6211\u77e5\u9053\u65b0\u540e\u7f00\u901f\u5ea6\u6700\u5feb\u7684\u6ce8\u518c\u5546API\u662f dynadot\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7c73\u8001\u5934<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-1 08:54:14\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e00\u822c\u597d\u7684\u90fd\u88abnamejet\u641e\u5b9a\u4e86 \u8fd9\u4e9b\u4ee3\u7801\u62a2\u4e0d\u8fc7\u7684\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>liuliuliu \u5927\u4f6c\u6709\u8bdd\u8bf4 :&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/44052"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44052"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/44052\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44052"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}