📜  curlopt_httpheader - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:55.884000             🧑  作者: Mango

代码示例1
$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);