You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2020-04-30 19:45:01

carlosbmc
Member
Registered: 2016-12-01
Posts: 159

Get APIREST result and print in a PHP page

Hello,  I have a simple question,

I'm doing this in php:

$json = file_get_contents($url_glpi); //get the json
$objhigher=json_decode($json); //converts to an object

echo "<pre>"; //box for code
print_r($objhigher); //prints the object with all key and values

If I do it using $url geting data from this sample $url='https://jsonplaceholder.typicode.com/users'

then prints all json result in htm

But if $url= 'http://glpi/apirest.php/getMyProfiles/?app_token=XXX&user_token=XXXXXX&session_token=XXXX';

then does not print anything,  returns white page.

Note:  if I put same glpi apirest url in a browser I cant see all profiles JSON formateed.

How can I solve this?

Thank you.


GLPI 9.5.2;; FusionInventory: 9.2+1.0;; GLPI Modifications 1.1.4;; Notifications 1.1.9;;  Dashboard 0.8.8;; PHP 7.3.33

Offline

Board footer

Powered by FluxBB