client.php 1.1 KB

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