Board logo

标题: 一段查快掉了的玉米的PHP代码 [打印本页]

作者: hrbeu    时间: 2005-2-26 21:01     标题: 一段查快掉了的玉米的PHP代码

<?php

  /* Enter your reseller login */
  $enom['user'] = 'username';
  $enom['pass'] = 'password';

  /* do not edit below */
  $debug = FALSE; // set to TRUE to disable script and check output of variables

  $enom['reseller'] = 'http://reseller.enom.com';

  $enom['doCheck'] = $enom['reseller'].'/interface.asp?command=Check&uid='
    .$enom['user'].'&pw='.$enom['pass'];
  $enom['doPurchase'] = $enom['reseller'].'/interface.asp?command=Purchase&uid='
    .$enom['user'].'&pw='.$enom['pass'];

  $enom['droplist'] = 'droplist-'.date("Ymd").'.txt';

  /* if today's droplist file exists, check for available names */
  if(!is_file($enom['droplist'])) { exit; }

  $enom['domains'] = rtrim(file_get_contents($enom['droplist']));
  $enom['csv'] = str_replace("\n",',',$enom['domains']);
  
  $enom['doList'] = $enom['doCheck'].'&DomainList='.$enom['csv'];

  if($debug) { print_r($enom); exit; }


  $enom['results'] = file_get_contents($enom['doList']);
  /* extract available names from Check/DomainList results */
  if( preg_match_all("|Domain\d{1,2}=(.*)\n|U",$enom['results'],$matches ) ) {
    $domains = $matches[1];
    if( preg_match_all("|RRPCode(\d{1,2})=210|U",$enom['results'],$matches) ) {
      foreach($matches[1] as $match) {
        $available[] = $domains[$match-1];
      }
    }
  }


  /* attempt to purchase available names */
  if(count($available)>0) {
    foreach($available as $domain) {
    list($sld,$tld) = explode('.',trim($domain));
    print "Registering $domain\n";
    $enom['register'] = file($enom['doPurchase'].'&tld='.$tld.'&sld='.$sld);
    }

}

print "\nDone.\n";
?>




欢迎光临 工程家园 (http://heubbs.com./) Powered by Discuz! 7.2