Hi,
I’m trying to use the server api to post a charged event but I always get an error. My php code looks like:
$events = '[{"WZRK_G":"c9a9f18c0e5e43048cbee329476b3d1f","ts":1463402032,"type":"event","evtName":"Charged","evtData":{"Amount":10.8,"Currency":"EUR","Charged ID":330455,"Items":[{"Quantity":1,"Number":"xxxxx"}]}}]’;
$params = array(
"d" => $events
);
$ch = curl_init("https://api.clevertap.com/up?id=my_account_id&p=my_passcode");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$start = time();
$getResult = curl_exec($ch);
$stop = time();
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) {
Logger::getLogger('clevertap')->error("Error: " . curl_errno($ch) . " -> " . curl_error($ch));
} else {
Logger::getLogger('clevertap')->debug("Clevertap result:".$getResult);
}
I tried a lot of combinations for $params value without success.
What is wrong?
Thanks,