Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php api call with headers

<?php
$options = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"CustomHeader: yay
" .
              "AnotherHeader: test
"
  )
);
$context=stream_context_create($options);
$data=file_get_contents('http://www.someservice.com/api/fetch?key=1234567890',false,$context);
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #api #call #headers
ADD COMMENT
Topic
Name
4+5 =