跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 通过PHP代码进行域名抢注的技术资料分享
未分類
27 2 月 2020

通过PHP代码进行域名抢注的技术资料分享

liuliuliu 大佬有话说 : 2019-12-1 08:39:36

通过PHP代码进行域名抢注的技术资料分享

数天前,我曾经发帖详细介绍了通过域名抢注发财的业务流程,朋友们反应热烈,有人加我问哪里有相关抢注代码

就像帖子 https://www.hostloc.com/thread-613066-1-1.html 说的,域名抢注需要代码的主要是两个地方 1.查询 whois 2.提交api

第二点 提交api的代码,这个主要得根据服务商提供的api文档进行编程

hexonet 的API文档地址 https://github.com/hexonet/hexonet-api-documentation/blob/master/API/DOMAIN/ADDDOMAIN.md

也有程序员为 hexonet 的api接口提供了一个PHP源码 https://github.com/al-one/hexonet-api

dynadot.com 的抢注API地址 https://www.dynadot.com/domain/api2.html ,它比较简单,只要一个get 或者post 到一个地址 https://api.dynadot.com/api2.html?key=8S7I2s6Qd8g&command=register&domain=mydomain.com&duration=1

quyu.net 也有API接口,这个要向趣域客服申请,API PHP 示例代码 https://www.quyu.net/knowledgebase.php?action=displayarticle&id=23

关于第一点,通过PHP代码查询whois的方式主要有两个 1.CURL 2.SOCKET 下面就是相关代码

CURL

const TIMEOUT = 30;
const PORT = 43;
const ESTR = ‘Domain not found’;
function whois(string $domain, string $address): array
    {
      $curl = null;
      $output = ”;
      $info = array();

      if (!function_exists(‘curl_version’)) {
            trigger_error(‘cURL is not found!’);
      } else {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, $address);
            curl_setopt($curl, CURLOPT_PORT, PORT);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl, CURLOPT_TIMEOUT, TIMEOUT);
            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $domain . "rn");
            $output = curl_exec($curl);
            curl_close($curl);

            $info[‘domain’] = $domain;
            (strstr($output, ESTR)) ? $info[‘status’] = 0 : $info[‘status’] = 1;
            (strstr($output, ESTR)) ? $info[‘description’] = ‘掉啦,赶紧抢吧’ : $info[‘description’] = ‘卧槽,还没掉’;
            $info[‘whois’] = $output;
      }

      return($info);
    }
print_r(whois(‘a.dog’,’whois.nic.dog’));

SOCKET

const TIMEOUT = 30;
const PORT = 43;
const ESTR = ‘Domain not found’;
function whois(string $domain, string $address): array
    {
      $output = ”;
      $info = array();
      $connection = fsockopen($address, PORT, $errno, $errmessage, TIMEOUT);

      if (!$connection) {
            echo(‘Connection failed! ‘ . ‘Error no: ‘ . $errno . ‘ Error message: ‘ . $errmessage);
            exit();
      } else {
            ($connection) ? fputs($connection, $domain . "rn") : $connection = null;

            if (!is_null($connection)) {
                while (!feof($connection)) $output .= fgets($connection);

                  $info[‘domain’] = $domain;
            (strstr($output, ESTR)) ? $info[‘status’] = 0 : $info[‘status’] = 1;
            (strstr($output, ESTR)) ? $info[‘description’] = ‘掉啦,赶紧抢吧’ : $info[‘description’] = ‘卧槽,还没掉’;
            $info[‘whois’] = $output;

            } else {
                trigger_error(‘$connection variable is null!’);
                exit();
            }
      }
      fclose($connection);

      return($info);
    }
print_r(whois(‘a.dog’,’whois.nic.dog’));

然后你找到一个定时任务的脚本,以一定的间隔执行PHP代码查询whois服务器,当发现某个域名掉了,立刻执行域名注册API即可

最后祝大家马到成功,财源滚滚

:lol :handshake

秘密 大佬有话说 : 2019-12-1 08:44:19

liuliuliu 大佬有话说 : 2019-12-1 08:48:12

秘密 大佬有话说 : 2019-12-1 08:44
真正的好域名都要竞价,哪轮得到自己抢住

我这里主要是针对非主流冷门后缀,主流的 com net org 没想过要自己抢,就像当年掉的 com.ax tom.cat 这种,都是可以通过自己的技术手段悄悄抢注的

lyhiving 大佬有话说 : 2019-12-1 08:49:59

最快的接口还是enom,还是乖乖开个根API账号吧

liuliuliu 大佬有话说 : 2019-12-1 08:51:03

lyhiving 大佬有话说 : 2019-12-1 08:49
最快的接口还是enom,还是乖乖开个根API账号吧

enom没用过,我知道新后缀速度最快的注册商API是 dynadot

米老头 大佬有话说 : 2019-12-1 08:54:14

一般好的都被namejet搞定了 这些代码抢不过的

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具