Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $subdomain="amestrov";
- $client_id="LworutTiRfoYZLpbE4B9aQ";
- $client_secret="pn2bgiu2l5B-qHIx6NAPdiNDOxlKXndDZJRoRXfpDYw1kmqNLp8LYk341sy3VxPQtHvndpbdf6wRAqJ3ztvG8g";
- $redirect_uri="http%3A%2F%2Fclients.neuralab.net%2Fclient-area%2F";
- $url='https://'.$subdomain.'.harvestapp.com/oauth2/authorize?client_id='.$client_id.'&redirect_uri='.$redirect_uri.'&state=optional-csrf-token&response_type=code';
- if(!isset($_GET['code'])){
- wp_redirect($url);
- exit;
- }
- else{
- $code=$_GET['code'];
- $pp=array(
- 'code' => $code,
- 'client_id' => $client_id,
- 'client_secret' => $client_secret,
- 'redirect_uri' => $redirect_uri,
- 'grant_type' => 'authorization_code'
- );
- $ppp = json_encode($pp);
- echo $ppp;
- $post_data="code=".$code."&client_id=".$client_id."&client_secret=".$client_secret."&redirect_uri=".$redirect_uri."&grant_type=authorization_code";
- $headers = array(
- "Content-type:application/x-www-form-urlencoded",
- );
- // $post_data="grant_type=password&username=alenmestrov@gmail.com&password=399ae0c91";
- $ch=curl_init();
- curl_setopt($ch, CURLOPT_URL,"https://".$subdomain.".harvestapp.com/oauth2/token");
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $ppp);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $server_output = curl_exec($ch);
- curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement