📜  带有标头的 php api 调用 - PHP 代码示例

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

代码示例1
array(
    'method'=>"GET",
    'header'=>"CustomHeader: yay\r\n" .
              "AnotherHeader: test\r\n"
  )
);
$context=stream_context_create($options);
$data=file_get_contents('http://www.someservice.com/api/fetch?key=1234567890',false,$context);
?>