0
I’m trying to create a PHP file that does direct authentication on GRAPHANA and displays the DASHBOARD on my page, but is not displaying anything with the structure below:
<?php
//Server url
$url = "http://meu-ip/api/dashboards/home";
$apiKey = 'aqui-vem-a-chave'; // should match with Server key
$headers = array(
'Authorization: Bearer '.$apiKey
);
// Send request to Server
$ch = curl_init($url);
// To save response in a variable from server, set headers;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Get response
$response = curl_exec($ch);
// Decode
$result = json_decode($response);
?>
I created a KEY API on the graph to make this authentication.
see if the problem is not adding a curl_close($ch); before the $result
– Luan Brito
Parse error: syntax error, Unexpected '$result' (T_VARIABLE) in C: xampp htdocs front-end teste.php on line 18
– Luis Henrique
Returned the above error
– Luis Henrique
if I place a print_r(), without the curl_close($ch), in $result, the output is: stdClass Object ( [redirectUri] => /d/hc63X9VZz/menu-Automation )
– Luis Henrique