пытается зарегистрировать / купить домен с помощью Godaddy API - PullRequest
0 голосов
/ 27 января 2020

Я пытаюсь интегрировать API GoDaddy на своем веб-сайте для покупки доменов, в настоящее время я могу проверить, доступен ли домен, но я получаю сообщение об ошибке, когда пытаюсь его зарегистрировать / купить, и я не получаю Я действительно не понимаю, что это значит. Я не знаю, есть ли у меня проблема с синтаксисом или что-то еще.

Я пытаюсь сделать это с помощью:

POST URL https://api.ote-godaddy.com/v1/domains/purchase
$header = array (
    'Accept: application/json',
    'X-Shopper-Id: ' . $data_json['x-shopper-id'],
    'Authorization: sso-key ' . GODADDY_KEY . ':' . GODADDY_SECRET,
    'Content-Type: application/json'
);
$ch = curl_init();
$timeout = 60;

curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_body  );
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_POST, true );
$result = curl_exec( $ch ); 

я получаю следующую ошибку:

string(134) "string(47) "https://api.ote-godaddy.com/v1/domains/purchase" string(59) "{"code":"ERROR_INTERNAL","message":"Not Found : Not Found"}" "

это тело, которое я использую

$domain = 'eldanterino.co';
$dnra = 'DNRA';
$autoRenew = 'true'; // either true or false
$period = 2; // for 2 year registration
$privacy = 'false'; // either true or false for privacy to be included
$agreeAtTime = '2019-12-05T18:50:13Z'; //format: YYYY-MM-DDTHH:MM:SSZ
$agreedByIP = $_SERVER['REMOTE_ADDR']; //IP address of your client or web server executing script

// address information for domain
$addressOne = '2 Rue Saint Germain E #110';
$addressTwo = ' ';
$city = 'Rimouski';
$country = 'CAN';
$postalCode = 'G5L 8T7';
$state = 'Quebec';

// contact information for domain
$email = 'info@test.com';
$fax = '+1.4185090592';
$jobTitle = 'Owner';
$nameFirst = 'Cesar';
$nameLast = 'Gonzalez';
$nameMiddle = 'A';
$organization = 'Magikweb';
$phone = '+1.4187227510';

// custom name server values to point/redirect domains
$nameserver_one = 'ns02.ote.domaincontrol.com';

$arr_body = array(
    'consent'   => array(
      'agreedAt'      => $agreeAtTime,
      'agreedBy'      => $agreedByIP,
      'agreementKeys' => array(
        $dnra
      )
    ),
    'contactAdmin'  => array(
      'addressMailing'  => array(
        'address1'      =>  $addressOne,
        'address2'      =>  $addressTwo,
        'city'          =>  $city,
        'country'       =>  $country,
        'postalCode'    =>  $postalCode,
        'state'         =>  $state
      ),
      'email'         =>  $email,
      'fax'           =>  $fax,
      'jobTitle'      =>  $jobTitle,
      'nameFirst'     =>  $nameFirst,
      'nameLast'      =>  $nameLast,
      'nameMiddle'    =>  $nameMiddle,
      'organization'  =>  $organization,
      'phone'         =>  $phone
    ),
    'contactBilling'  => array(
      'addressMailing'  => array(
        'address1'      =>  $addressOne,
        'address2'      =>  $addressTwo,
        'city'          =>  $city,
        'country'       =>  $country,
        'postalCode'    =>  $postalCode,
        'state'         =>  $state
      ),
      'email'         =>  $email,
      'fax'           =>  $fax,
      'jobTitle'      =>  $jobTitle,
      'nameFirst'     =>  $nameFirst,
      'nameLast'      =>  $nameLast,
      'nameMiddle'    =>  $nameMiddle,
      'organization'  =>  $organization,
      'phone'         =>  $phone
    ),
    'contactRegistrant'  => array(
      'addressMailing'  => array(
        'address1'      =>  $addressOne,
        'address2'      =>  $addressTwo,
        'city'          =>  $city,
        'country'       =>  $country,
        'postalCode'    =>  $postalCode,
        'state'         =>  $state
      ),
      'email'         =>  $email,
      'fax'           =>  $fax,
      'jobTitle'      =>  $jobTitle,
      'nameFirst'     =>  $nameFirst,
      'nameLast'      =>  $nameLast,
      'nameMiddle'    =>  $nameMiddle,
      'organization'  =>  $organization,
      'phone'         =>  $phone
    ),
    'contactTech'  => array(
      'addressMailing'  => array(
        'address1'      =>  $addressOne,
        'address2'      =>  $addressTwo,
        'city'          =>  $city,
        'country'       =>  $country,
        'postalCode'    =>  $postalCode,
        'state'         =>  $state
      ),
      'email'         =>  $email,
      'fax'           =>  $fax,
      'jobTitle'      =>  $jobTitle,
      'nameFirst'     =>  $nameFirst,
      'nameLast'      =>  $nameLast,
      'nameMiddle'    =>  $nameMiddle,
      'organization'  =>  $organization,
      'phone'         =>  $phone
    ),
    'domain'    =>  $domain,
    'nameServers'   =>  array(
      $nameserver_one
    ),
    'period'      =>  $period,
    'privacy'     =>  $privacy,
    'renewAuto'   =>  $autoRenew
  );
$json_body = json_encode( $arr_body );
...