Guest User

Untitled

a guest
Jan 20th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. $token = $_GET['useToken'];
  3. $inApp = $_GET['inApp'];
  4. if($inApp){
  5. $token = "<script>document.write(webview.getUserId())</script>";
  6. };
  7. echo $token;
  8.  
  9. $curl = curl_init();
  10.  
  11. curl_setopt_array($curl, array(
  12. CURLOPT_URL => $url,
  13. CURLOPT_RETURNTRANSFER => true,
  14. CURLOPT_ENCODING => "",
  15. CURLOPT_MAXREDIRS => 10,
  16. CURLOPT_TIMEOUT => 30,
  17. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  18. CURLOPT_CUSTOMREQUEST => 'GET',
  19. CURLOPT_POSTFIELDS => "",
  20. CURLOPT_HTTPHEADER => array(
  21. "Authorization: Bearer ".$token,
  22. "cache-control: no-cache"
  23. ),
  24. ));
  25.  
  26. $response = curl_exec($curl);
  27. $err = curl_error($curl);
  28.  
  29. curl_close($curl);
  30.  
  31. if ($err) {
  32. echo "cURL Error #:" . $err;
  33. } else {
  34. return json_decode($response);
  35. };
  36. ?>
Add Comment
Please, Sign In to add comment