Advertisement
Slapoguzov

Bitrix_1

Jul 25th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. require("include/config.php");
  3. require("include/RestAPI.php");
  4. session_start();
  5.  
  6. if(!isset($_SESSION['rest']))
  7. {
  8. $domain = 'tashcompan.bitrix24.ru';
  9. $rest = new RestAPI($domain,CLIENT_ID,REDIRECT_URI,CLIENT_SECRET,SCOPE);
  10. $_SESSION['rest'] = $rest;
  11. }
  12. else
  13. {
  14. $rest=$_SESSION['rest'];
  15. }
  16.  
  17. if($rest->status_auth === "step1" && isset($_GET['code']))
  18. {
  19. $res = $rest->auth_step2($_GET['code']);
  20. if($rest->status_auth==="fail")
  21. {
  22. echo "<b>Error:</b> ".$res;
  23. }
  24. }
  25. else if($rest->status_auth != "success" && !isset($_GET['code']))
  26. {
  27. $rest->auth_step1();
  28. }
  29. $params = array(
  30. 'ENTITY' => 'olsdolo',
  31. 'NAME' => 'ololsol',
  32. 'ACCESS' => array(
  33. "U1" =>'W',
  34. "AU" =>'R',),
  35. );
  36.  
  37. if($rest->status_auth === "success")
  38. {
  39. $res = $rest->callMethod("entity.get");
  40. var_dump($res);
  41. }
  42.  
  43.  
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement