Please see below code. one is for read and second is for posting data <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.cc.email/v3/contact_lists?include_count=true&status=active&include_membership_count=all', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Accept: */*', 'Content-Type: application/json', 'Authorization: Bearer '.$access_token ), )); $response = curl_exec($curl); curl_close($curl); echo '<pre>'; print_r(json_decode($response)); exit; ?> <?php $url = 'https://api.cc.email/v3/contacts'; $postdata = '{ "email_address": { "address": "sibinfotech101@gmail.com", "permission_to_send": "implicit" }, "create_source": "Account", "custom_fields": [ { "custom_field_id": "0123895a-35cd-11ee-a3a3-fa163eb65cb7", "value": "Tushar" }, { "custom_field_id": "485b7d4a-35dd-11ee-a3a3-fa163eb65cb7", "value": "9099887766" }, { "custom_field_id": "0863b528-35cd-11ee-bcfd-fa163eb65cb7", "value": "Test Subject" }, { "custom_field_id": "0d7f2f92-35cd-11ee-bcfd-fa163eb65cb7", "value": "Test Message" } ] }'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Cache-Control' => 'no-cache', 'Authorization' => 'Bearer '.$access_token, 'Accept' => 'application/json', 'Content-Type' => 'application/json', )); $result = curl_exec($ch); curl_close($ch); print_r ($result); exit; ?>
... View more