我正在尝试使用curl发出POST请求以从页面检索考试结果:http://wbutech.net/result_odd.php ....我正在使用以下语法,但尽管我使用 -L 选项,但仍显示各种错误(例如内容已永久移动)... curl -L --data-urlencode“semno=7&rectype=1&rollno=10400111005”http://wbutech.net/show-result.php
任何人都可以请在此处发布工作语法,它可以正确地处理上述链接并检索结果吗?
(示例用法是输入 roll 作为 10400111005 并单击常规学生下的 season7 按钮...这就是我尝试使用上述curl 语法执行的操作)
最佳答案
尝试:
curl -XPOST http://wbutech.net/show-result.php -d '{"semno": 7, "rectype": 1, "rollno": 10400111005}'
除了 301/302 重定向之外,该网站还需要使用凭据,请尝试:
curl -u user:passwd -XPOST http://50.28.104.43/show-result.php -d'{"semno": 7, "rectype": 1, "rollno": 10400111005}'
将 user:passwd
替换为您的真实用户名和密码。
关于linux 的curl POST 请求不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28872243/