BatchTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php /*
  2. * Copyright (C) 2017 All rights reserved.
  3. *
  4. * @File BatchTest.php
  5. * @Brief
  6. * @Author abelzhu, abelzhu@tencent.com
  7. * @Version 1.0
  8. * @Date 2017-12-26
  9. *
  10. */
  11. include_once("../src/CorpAPI.class.php");
  12. include_once("../src/ServiceCorpAPI.class.php");
  13. include_once("../src/ServiceProviderAPI.class.php");
  14. $config = require('./config.php');
  15. // 需启用 "管理工具" -> "通讯录同步", 并使用该处的secret, 才能通过API管理通讯录
  16. //
  17. $api = new CorpAPI($config['CORP_ID'], $config['CONTACT_SYNC_SECRET']);
  18. try {
  19. //
  20. $batchJobArgs = new BatchJobArgs();
  21. {
  22. $batchJobArgs->media_id = "1yyrBujtAp1U04xwuoevYqSEK0osexgr900H9iP4xBrdj0QVWgl2Jc-0u-F3S7SJVXKSslr10C0YgAlfdKKganA";
  23. $batchJobArgs->callback->url = "www.qq.com";
  24. $batchJobArgs->callback->token = "token";
  25. }
  26. $jobId = $api->BatchSyncUser($batchJobArgs);
  27. echo $jobId . "\n";
  28. //
  29. $jobResult = $api->BatchJobGetResult($jobId);
  30. var_dump($jobResult);
  31. //
  32. } catch (Exception $e) {
  33. echo $e->getMessage() . "\n";
  34. }