User-Agent must be in the format of the program name/version (email address). Common browsers are not allowed to be forged; otherwise, the firewall of DNSPod may reject the requests.function postData($url, $data) {$data = http_build_query($data);$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);// curl_setopt($ch, CURLOPT_HEADER, 1);// curl_setopt($ch, CURLOPT_VERBOSE, 1);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_USERAGENT, 'program name/version (email address)');curl_setopt($ch, CURLOPT_POSTFIELDS, $data);$response = curl_exec($ch);curl_close($ch);return $response;}
$data = array('login_email' => 'foo@bar.com','login_password' => 'password','format' => 'xml','domain' => 'test.com');echo postData("https://api.dnspod.com/Domain.Create", $data);
$data = array('login_email' => 'foo@bar.com','login_password' => 'password','format' => 'xml','domain_id' => '123456');echo postData("https://api.dnspod.com/Record.List", $data);
Feedback