client.php 1017 B

123456789101112131415161718192021222324252627282930
  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. // include nusoap library
  21. require_once(api_get_path(LIBRARY_PATH).'nusoap/nusoap.php');
  22. // create client
  23. $client = new nusoap_client(api_get_path(WEB_CODE_PATH).'cron/user_import/service.php');
  24. // call import_user method
  25. $response = $client->call('import_users', array('filepath' => api_get_path(SYS_CODE_PATH)."upload/users_import.csv", 'security_key'=>$_configuration['security_key']));
  26. echo $response;