<?php $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"password: mypassword\r\n" . "Accept-language: en\r\n" ) ); $context = stream_context_create($opts); $response = file_get_contents('my/api/url', false, $context); $results = json_decode($response); echo "<pre>"; print_r($results); echo "</pre>"; ?>
ref: – php.net
This is soo easy, I was using curl for making rest call,
Thanks bm