购买的GODADDY DOMAIN API收到400错误的请求客户端错误

时间:2019-07-03 13:23:52

标签: godaddy-api

[03-Jul-2019 09:27:28 UTC]错误已打印:客户端错误:POST https://api.godaddy.com/v1/domains/purchase导致了400 Bad Request响应: {“ code”:400,“ message”:“从\” \“解析正文正文失败,因为无效字符'd'寻找值的开头”}

仅在购买路线上,其余所有路线都可以正常运行,例如:域,可用

WHM操作系统版本:CENTOS 6.10 KVM [服务器] 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 () );
}

0 个答案:

没有答案
相关问题