i am facing an issue i just need to send an array in header and some parameters in body but when i add
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Token:'.$token));
this line sends token but parameters array get empty but when i just remove the line, parameters successfully send but token is missing
here is the code have look:
$data = array(
'name' => $_POST['name'],
'city' => $_POST['city'],
'mobileNo' => $_POST['mobileNo'],
);
$params = http_build_query($data);
$curl = curl_init('URL');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array('Token:'.$token));
$result = curl_exec($curl);