· 9 years ago · Oct 28, 2016, 05:30 AM
1$headers = array(
2 'OAuth-Token: '.$access_token
3);
4$bulk_data = array('requests' => array());
5foreach($ids as $id)
6{
7 $bulk_request_data = array(
8 'bulk' => '1',
9 'contentType' => 'application/json',
10 'dataType' => 'json',
11 'headers' => $headers,
12 'timeout' => 100000,
13 'method' => 'DELETE',
14 'url' => 'v10/Contacts/'.$id,
15 );
16 $bulk_data['requests'][] = $bulk_request_data;
17}
18$url = $base_url.'/rest/v10/bulk'
19$curl = curl_init();
20
21$default_options = array(
22 CURLOPT_RETURNTRANSFER => true,
23 CURLOPT_SSL_VERIFYPEER => false,
24 CURLOPT_SSL_VERIFYHOST => false,
25);
26curl_setopt_array($curl, $default_options);
27curl_setopt($curl, CURLOPT_POST, TRUE);
28curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($bulk_data));
29curl_setopt($curl, CURLOPT_URL, $url);
30
31$curl_response = curl_exec($curl);
32curl_close($curl);