work-department.php 1.2 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://think.ctolog.com
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | github开源项目:https://github.com/zoujingli/WeChatDeveloper
  12. // +----------------------------------------------------------------------
  13. use WeChat\Contracts\BasicWeWork;
  14. include '../include.php';
  15. $config = include 'work-config.php';
  16. try {
  17. $url = 'https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=ACCESS_TOKEN';
  18. $result = BasicWeWork::instance($config)->callGetApi($url);
  19. echo '<pre>';
  20. print_r(BasicWeWork::instance($config)->config->get());
  21. print_r($result);
  22. echo '</pre>';
  23. } catch (Exception $exception) {
  24. echo $exception->getMessage() . PHP_EOL;
  25. }