Skip to content

Instantly share code, notes, and snippets.

@jonathonklem
Created January 7, 2016 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathonklem/68d67e0d9aea96a5599d to your computer and use it in GitHub Desktop.
Save jonathonklem/68d67e0d9aea96a5599d to your computer and use it in GitHub Desktop.
<?php
class EvolutionAPI {
private $_url = 'https://apitest.evolutionpayroll.com/';
private $_token;
function __construct($username, $password) {
$ch = curl_init();
$fields = array(
'grant_type' => 'password',
'username' => $username,
'password' => $password
);
curl_setopt($ch, CURLOPT_URL, $this->_url . 'identity/v1/token/bureau/sandbox');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Basic ' . base64_encode($username.':'.$password), 'User-Agent: Fiddler', 'Content-Type: appli
cation/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
$result = curl_exec($ch);
die(print_r($result));
curl_close($ch);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment