Skip to content

Instantly share code, notes, and snippets.

@mefarazath
Created August 18, 2017 09:51
Show Gist options
  • Save mefarazath/86999df322fe637efbef3d34777c9fc5 to your computer and use it in GitHub Desktop.
Save mefarazath/86999df322fe637efbef3d34777c9fc5 to your computer and use it in GitHub Desktop.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "9443",
CURLOPT_URL => "https://localhost:9443/oauth2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=password&username=admin&password=admin&scope=admin&=",
CURLOPT_HTTPHEADER => array(
"authorization: Basic MmJxbHM0U3lESjRjOHlDOE5ub2pFRHlVZmdVYTpoNHdKSmlIVWZ3OHNIWlRwTXU2dzZIaHppRGNh",
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
"postman-token: add7c24e-737e-b9cf-1c07-d5c114949479"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment