work-department.php 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免责声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
  13. // | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
  14. // +----------------------------------------------------------------------
  15. use WeChat\Contracts\BasicWeWork;
  16. include '../include.php';
  17. $config = include 'work-config.php';
  18. try {
  19. $url = 'https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=ACCESS_TOKEN';
  20. $result = BasicWeWork::instance($config)->callGetApi($url);
  21. echo '<pre>';
  22. print_r(BasicWeWork::instance($config)->config->get());
  23. print_r($result);
  24. echo '</pre>';
  25. } catch (Exception $exception) {
  26. echo $exception->getMessage() . PHP_EOL;
  27. }