@ 2015-12-17T05:51:56Z <?php
$data = array('users'=>array(
array(
'username'=>'testusername1',
'password'=>'testpassword1',
'firstname'=>'test',
'lastname'=>'user',
'email'=>'testusername@fakemail.com'
)
));
$ch = curl_init("http://vps02.ouhk.edu.hk/~qess/webservice/rest/server.php?wstoken=f4dfb904d79777f22cafe3c7472b744c&wsfunction=core_user_create_users&moodlewsrestformat=json");
curl_setopt_array($ch,array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_POST => true, // i am sending post data
CURLOPT_POSTFIELDS => http_build_query($data), // this are my post vars
CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl
CURLOPT_SSL_VERIFYPEER => false, //
CURLOPT_VERBOSE => 1 //
));
var_dump(curl_exec($ch));
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/XO6aN:12
Stack trace:
#0 {main}
thrown in /in/XO6aN on line 12
Process exited with code 255 . Output for 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 Fatal error: Call to undefined function curl_init() in /in/XO6aN on line 12
Process exited with code 255 . preferences:dark mode live preview
192.28 ms | 402 KiB | 213 Q