client.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. */
  14. /**
  15. * Global cycle: init, execute, output
  16. */
  17. require_once('../../inc/global.inc.php');
  18. // check if this client has been called by php_cli (command line or cron)
  19. if(php_sapi_name()!='cli')
  20. {
  21. echo 'You can\'t call this service throw 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;
  31. ?>