I want response from an API by passing parameters to header. Here is what I had done:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"API url goes here");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$vars); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = 'auth_type:email';
$headers[] = 'user_name:testuser';
$headers[] = 'password:123456';
$headers[] = 'app_key:someapikey';
$headers[] = 'platform:platform name';
$headers[] = 'api_version: 1.0';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
curl_close ($ch);
print $server_output ;
?>
But Iam getting a blank page in response. Where Iam doing wrong?