client.php 970 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /* See license terms in /license.txt */
  3. /**
  4. * This is a script used to automatically import a list of users from
  5. * a CSV file into Dokeos.
  6. * It is triggered by a cron task configured on the server
  7. * @uses /main/webservices/user_import/
  8. * @author Eric Marguin <eric.marguin@dokeos.com>
  9. * @package chamilo.cron
  10. */
  11. /**
  12. * Global cycle: init, execute, output
  13. */
  14. require_once dirname(__FILE__).'/../../inc/global.inc.php';
  15. // check if this client has been called by php_cli (command line or cron)
  16. if (php_sapi_name()!='cli') {
  17. echo 'You can\'t call this service through a browser';
  18. die();
  19. }
  20. // create client
  21. $client = new nusoap_client(api_get_path(WEB_CODE_PATH).'cron/user_import/service.php');
  22. // call import_user method
  23. $response = $client->call(
  24. 'import_users',
  25. array(
  26. 'filepath' => api_get_path(SYS_UPLOAD_PATH)."users_import.csv",
  27. 'security_key' => api_get_configuration_value('security_key'),
  28. )
  29. );
  30. echo $response;