Web services

Get a user token https

Picture of Dante Basile
Get a user token https

I read this document: http://docs.moodle.org/dev/Creating_a_web_service_client#How_to_get_a_user_token.

When I call this page: https://www.yourmoodle.com/login/token.php?username=USERNAME&password=PASSWORD&service=SERVICESHORTNAME

The result is this error message: "Can not download token.php. Can not open the internet site. Site not available or not found. Try again at a later time"; if I use http protocol I can download token.php but I don't want this.

As server I use WAMP and with openssl create files to use HTTPS protocol but because this is a local certificate is local I get a warning message: "There was a problem with the security certificate of the website". Can help me?


Average of ratings: -
Picture of Oliver Obermayr
Re: Get a user token https

You need enable https:// in your php.ini file:

  • extension=php_openssl.dll (uncomment it)
  • allow_url_include = On (change to on)

then try again with cURL using following parameters:

  • curl_setopt($ch, CURLOPT_SSLCERT, "example.p12");
  • curl_setopt($ch, CURLOPT_SSLCERTTYPE, "P12");
  • curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "password here");
Average of ratings: -