PHP code example of tchenu / myges

1. Go to this page and download the library: Download tchenu/myges library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tchenu / myges example snippets








    // client-id = skolae-app
    $client = new MyGes\Client('skolae-app', 'your-login', 'your-password');
} catch(MyGes\Exceptions\BadCredentialsException $e) {
    die($e->getMessage()); // bad credentials
}




    $client = new MyGes\Client('<client-id>', '<login>', '<password>');
} catch(MyGes\Exceptions\BadCredentialsException $e) {
    die($e->getMessage()); // bad credentials
}

$me = new MyGes\Me($client);

$profile = $me->getProfile();

echo  "<img src='". $profile->_links->photo->href ."'></br>";
echo  "Nom : ". $profile->name ."</br>";
echo  "Prenom : ". $profile->firstname ."</br>";