Created
January 7, 2016 17:51
-
-
Save jonathonklem/fcb0c112f22d1d89e305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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