Help with api Error Parse error: syntax error, Unexpected

Asked

Viewed 17 times

0

<?php

$service_url = 'http://coversat.localize.cc/api/statuses';

$curl = curl_init($service_url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = ['X-Client-Id: XXXXXXX',

    'X-Client-Secret: XXXXXX',

    'Content-Type: application/json; charset=utf-8'

];



curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);



$curl_response = curl_exec($curl);

curl_close($curl);



if ($curl_response === false) {

    $info = curl_getinfo($curl);

    curl_close($curl);

    die('error occured during curl exec. Additioanl info: ' . var_export($info));

} else {

  $decoded = json_decode($curl_response);

 

 



  

}



?>

  • What exactly do you want?

  • You are running curl_close twice. That doesn’t seem to make much sense.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.