0
`curl -H "Authorization: Token token=YOUR_TOKEN" https://api.upcall.com
 /api/v1/calls`

how to used in php means how to request in php

$service_url = "https://api.upcall.com/api/v1/calls";
$ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $service_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: 12345' // you can replace this with your $auth variable
));
chris85
  • 23,846
  • 7
  • 34
  • 51
SirajuddinLuck
  • 141
  • 1
  • 8

2 Answers2

0

Your api call should be something like so:

$service_url = "https://api.upcall.com/api/v1/calls";
$ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $service_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Authorization: Token token=YOUR_TOKEN'
    ));
$result = curl_exec ( $ch );
curl_close ( $ch );

Above is the php conversion of the curl command:

curl -H "Authorization: Token token=YOUR_TOKEN" https://api.upcall.com/api/v1/calls
Shakti Phartiyal
  • 6,156
  • 3
  • 25
  • 46
0
    $url = 'https://api.upcall.com/api/v1/calls';
    $headers = array (
            'Authorization: token=YOUR_TOKEN'
    );
    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_URL, $url );
    curl_setopt ( $ch, CURLOPT_POST, true );
    curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers );
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields );
    $result = curl_exec ( $ch );
    curl_close ( $ch );
Kamran Sohail
  • 602
  • 7
  • 13