Php Api Call With Headers

[Solved] Php Api Call With Headers | Php - Code Explorer | yomemimo.com
Question : php api call with headers

Answered by : defeated-dotterel-isn14vapl10a

<?php
$options = array( 'http'=>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);
?>

Source : https://stackoverflow.com/questions/10524543/how-to-pass-custom-header-to-restful-call | Last Update : Mon, 01 Nov 21

Answers related to php api call with headers

Code Explorer Popular Question For Php