1. Go to this page and download the library: Download i3-hackathon/bmw-php-sdk 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/ */
// ...
<<<<<<< HEAD
// Authenticate specific user
$client->login(array(
'userOrEmail' => '[email protected]',
'password' => 'mypassword',
));
=======
// Set the redirect URI to point to this exact same script.
$redirectUri = (isset($_SERVER['HTTPS']) ? 'https' : 'http')
. '://' . $_SERVER['HTTP_HOST']
. strtok($_SERVER['REQUEST_URI'], '?');
if(!isset($_GET['code'])) {
// Initiate an OAuth request
header('Location: '.$client->getAuthorizationUrl($redirectUri));
exit;
} else {
// Handle the OAuth response
$client->authorize($redirectUri, $_GET['code']);
}
>>>>>>> da42bcc956e02bd4a8d9327ba5f8bee5528155a6
// ...
// Logout user.
$client->logout();
// ...
// Fetch first page of 15 users
$results = $client->getTrips(array(
'pageSize' => 15,
'page' => 1
));
foreach( $results as $trip )
{
// Do something with each trip
// ...
}
// ...
$mojioId = "0a5123a0-7e70-12d1-a5k6-28db18c10200";
// Fetch mojio from API
$mojio = $client->getMojio(array(
"id" => $mojioId
));
// Do something with the mojio data
// ...
// ...
$appId = "0a5123a0-7e70-12d1-a5k6-28db18c10200";
// Fetch app from API
$app = $client->getApp(array(
'id' => $appId
));
// Make a change
$app->Name = "New Application Name";
// Save the changes
$client->saveEntity(array(
'entity' => $app
));