Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. $api_url = "url";
  4. $username = "name";
  5. $password = "hitler";
  6. $ch = curl_init($api_url);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  8.  
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  10. 'Content-Type: application/json'
  11. ]);
  12.  
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
  14. 'identification' => $username,
  15. 'password' => $password
  16. ]));
  17.  
  18. $result = curl_exec($ch);
  19. $session = json_decode($result);
  20. $session->token;
  21. $session->userId;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement