“Open API”的版本间的差异
来自成绩云帮助中心
(创建页面,内容为“ == 登录 == https://[site_url]/?q=school-users/api/login POST参数:id - 学号, pass - 密码 PHP示例代码: <pre> $ch = curl_init(); curl_setopt($ch,...”) |
(没有差异)
|
2015年8月11日 (二) 14:57的版本
登录
https://[site_url]/?q=school-users/api/login
POST参数:id - 学号, pass - 密码
PHP示例代码:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://chengjiyun.com/demo/?q=school-users/api/login"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "id=20120101&pass=123"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $output = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code == 200 && $output) { $result = json_decode($output); var_dump($result); } else { echo "http_code: $http_code\n"; echo curl_error($ch); } curl_close ($ch);
示例结果:
object(stdClass)[202] public 'uid' => string '90' (length=2) public 'token' => string '7338c0954acba04b7dd5b8b74dfe2130' (length=32) public 'msg' => string 'login succeed' (length=13)