我尝试使用 ResellerClub API 添加客户,但出现错误“错误:缺少必需的身份验证参数”。我将感谢您的帮助。我已将我的 IP 地址添加到白名单中。也许还没有被批准。
Creating the new tags 'resellerclub resellerclupapi' requires at least 1500 reputation. Try something from the existing tags list instead.
<?php
class ResellerClubAPI {
// Configuration Of Reseller Club API
public $api_user_id = "number"; // API kullanıcı kimliği
public $api_key = "key"; // API anahtarı
// API URL'si
public $api_url = "https://test.httpapi.com/api/customers/signup.xml";
// Yeni müşteri hesabı oluşturma işlemi
public function createCustomerAccount($username, $name, $company, $address, $city, $state, $country, $zipCode, $phoneCC, $phone, $lang) {
$url = $this->api_url;
$data = array(
"auth-userid" => $this->api_user_id,
"api-key" => $this->api_key,
"username" => $username,
"name" => $name,
"company" => $company,
"address-line-1" => $address,
"city" => $city,
"state" => $state,
"country" => $country,
"zipcode" => $zipCode,
"phone-cc" => $phoneCC,
"phone" => $phone,
"lang-pref" => $lang
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
if($response === false) {
$error = curl_error($curl);
curl_close($curl);
return "cURL Error: " . $error;
}
curl_close($curl);
return $response;
}
}
// Kullanım örneği
$api = new ResellerClubAPI;
$response = $api->createCustomerAccount(
"[email protected]", // Kullanıcı adı
"John Doe", // Ad
"Example Company", // Şirket
"123 Example St", // Adres
"İstanbul", // Şehir
"Sultanbeyli", // Eyalet/Bölge
"TR", // Ülke
"34000", // Posta Kodu
"90", // Telefon kodu
"5555555555", // Telefon Numarası
"tr" // Dil tercihi
);
echo $response; // API yanıtını gösterir
?>
my code