1. Go to this page and download the library: Download olxbr/olx-api-client 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/ */
olxbr / olx-api-client example snippets
use OlxApiClient\Client;
w Client('olx_oauth_secrets.json');
if (isset($_SESSION['olx_access_token'])) {
$dadosUsuario = $client->call('basic_user_info', json_encode(array(
'access_token' => $_SESSION['olx_access_token']
)));
echo '<h1>Dados do Usuario</h1>';
var_dump(json_decode($dadosUsuario['body']));
} else {
echo '<a href="'.$client->createAuthUrl().'">Autentica</a>';
}
use OlxApiClient\Client;
w Client('olx_oauth_secrets.json');
if (!isset($_GET['code'])) {
echo '<a href = '.$client->createAuthUrl().'>Autentica</a>';
} else {
$_SESSION['olx_access_token'] = $client->authenticate($_GET['code']);
header('Location: http://'.$_SERVER['HTTP_HOST'].'/');
}