我正在尝试使用 V3 API 将联系人添加到 Constant Contact 帐户。一些用户数据包含重音字符,当我添加这些时,它unicode
在常量联系人帐户中显示为字符。
例如, 名字是GÒKÜL,姓氏是NÁTH。它始终显示为Gu00d2Ku00dcL 和Nu00c1TH。我想将这些显示为原创。
我认为问题出在我的 curl 函数中以添加/更新联系人。下面是代码
function updateContact($access_token,$contactid,$entry){
$ch = curl_init();
$base = 'https://api.cc.email/v3/';
$url = $base . '/contacts/'.$contactid;
curl_setopt($ch, CURLOPT_URL, $url);
$authorization = 'Authorization: Bearer ' . $access_token;
$ct = 'Content-Type: application/json;';
curl_setopt($ch, CURLOPT_HTTPHEADER, array($authorization, $ct));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $entry);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
我试过$ct = 'Content-Type: application/json; charset=UTF-8';
但$result = utf8_decode(curl_exec($ch));
没有工作。
我想有人可以帮助我..