<?php

/*
* Lead creation through API on neucrm
* For more info please refer: https://neucrm.com/docs/API/Leads
*/
// Step 1: Initialize required paramaters
$input = array(
'userid' => 15,
'api_key' => '7c5bcaec142c9cbb8ef81ab614072a8bac834fef8e14a64823',
'name' => 'Customer name',
'mobile' => '1234567',
'email' => 'abc@demo.com',
'address' => 'lead created from API',
'source' => 'Web',
'location_code' => 'MA2',
'sub_location_code' => 'MA2',
);
// Step 2: cURL function for API call
function api_request($url, $params){
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = json_decode(curl_exec($curl), true);
$curl_error = curl_error($curl);
curl_close($curl);
if( $curl_error) exit('curl error: '.$curl_error);
return $response;
}
// Step 3: Create lead by Calling cURL function
$response = api_request('https://omnipointcustomer.com/api/lead/create', $input);
print_r($response);