<?php
$curl = curl_init("https://api.avosms.com/v1/contact/list");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
$postfields = array(
'id' => "{ID}", //REQUIRED
'key' => "{KEY}", //REQUIRED
);
$postfields_json = json_encode($postfields);
$trame = http_build_query($postfields, '', '&');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $trame);
$raw_response = curl_exec($curl);
curl_close($curl);
$response = json_decode($raw_response);
$status_response = $response->status;
$code = $response->code;
if($code == "OK")
{
$listContact = $response->list_contact;
foreach($listContact as $contactList)
{
$listContactId = $contactList->list_contact_id;
$listContactName = $contactList->list_contact_name;
$listContactCountryName = $contactList->list_contact_country_name;
$listContactCountryCode = $contactList->list_contact_country_code;
$nbContactList = $contactList->nb_contact_list;
$listContactCreationDate = $contactList->list_contact_creation_date;
}
}
?>