GODADDY DOMAIN API для покупки получает ошибку клиента 400 Bad Request - PullRequest
1 голос
/ 03 июля 2019

[03-Jul-2019 09:27:28 UTC] напечатана ошибка: ошибка клиента: POST https://api.godaddy.com/v1/domains/purchase привел к ответу 400 Bad Request: {"code": 400, "message": "тело анализа из \«\» не удалось, поскольку недопустимый символ «d» ищет начало значения »}

Только на маршруте покупки, остальные все маршруты работают нормально, например: домен, доступно

Версия WHM OS:CENTOS 6.10 KVM [server] v78.0.13 Язык: клиент PHP 7.0 для доступа к API Используется: клиент Guzzle

Вот мой код Guzzle: -

try { $contactRegistrant = [ "nameFirst" => $row ['user_first_name'], "nameMiddle" => $row ['user_middle_name'], "nameLast" => $row ['user_last_name'], "organization" => $row ['user_organization'], "jobTitle" => $row ['user_job'], "email" => $row ['user_email'], "phone" => $row ['user_phone'], "fax" => "", "addressMailing" => [ "address1" => $row ['user_address1'], "address2" => '', "city" => $row ['user_city'], "state" => $row ['user_state'], "postalCode" => $row ['user_postal_code'], "country" => $row ['user_country'] ] ];





$form_params = [ 
          "domain" => $domain,
          "consent" => [ 
                  "agreementKeys" => [ 
                          $agreement->key 
                  ],
                  "agreedBy" => $agreedBy,
                  "agreedAt" => "2017-08-17T05:46:12Z" 
          ],
          // "period"=>1,
          "nameServers" => [
                  $nameServer1,
                  $nameServer2 
          ],
          // "renewAuto"=> 'true',
          // "privacy"=> 'true',
          "contactRegistrant" => $contactRegistrant,
          "contactAdmin" => $contactRegistrant,
          "contactTech" => $contactRegistrant,
          "contactBilling" => $contactRegistrant 
  ];



  $headers = [ 
          'Authorization' => "sso-key $AKEY:$SKEY",
          'Content-Type' => 'application/json',
          'X-Shopper-Id' => '?????????' 
  ];
  $url = 'v1/domains/purchase';
  //https://developer.godaddy.com/doc/endpoint/domains#/v1/purchase

  // Hitting the GODADDY REST API Using Guzzel CLIENT 
  $client = new GuzzleHttp\Client ( [ 
          'base_uri' => 'https://api.godaddy.com',
          'verify' => true 
  ] );

  $responce = $client->post ( $url, [ 
          'headers' => $headers,
          'form_params' => $form_params 
  ] );

  error_log ( 'godaddy response:' . json_encode ( $responce ) );
  return $responce->getBody ();
} catch ( Exception $e ) {
  error_log ( 'error printed :' . $e->getMessage () );
}
...