Answers for "curlopt_httpheader"

0

curlopt_httpheader

$curl = curl_init("https://jsonplaceholder.typicode.com/todos/1");
$headers = array(
  'Content-type: application/json',
  'Custom-Header: credentials',
);
$data = ['data1', 'data2'];
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$execute = curl_exec($curl);
print_r($execute);
curl_close($curl);
Posted by: Guest on August-02-2021

Browse Popular Code Answers by Language