Advertisement
Guest User

Untitled

a guest
Jan 1st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Request example 1:
  2. POST /v1/token HTTP/1.1
  3. Content-Type: application/x-www-form-urlencoded
  4. Accept: application/json
  5. grant_type=client_credentials&client_id=test&client_secret=abc123
  6.  
  7. $url = "someUrl";
  8. $ch = curl_init();
  9.  
  10. $username = "someUser";
  11. $password = "somePass";
  12.  
  13. $post = json_encode(array(('grant_type'=>'client_credentials'));
  14.  
  15. curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
  16. curl_setopt($ch,CURLOPT_URL,$url);
  17. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19. curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
  20. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  21. $result = curl_exec($ch);
  22. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement