cURL works from Terminal, but not from PHP

后端 未结 4 2041
深忆病人
深忆病人 2021-02-19 00:56

I\'m running into a rather strange issue.

I\'m trying to log into a remote moodle install using curl from PHP.

I have a curl command, which works perfectly in th

4条回答
  •  盖世英雄少女心
    2021-02-19 02:00

    I suspect your first attempt using the curl command is using the GET method in the index.php file. I suggest you enable --trace-ascii on your first curl request in the command line and see whether a GET request is being made by the page or not. If yes, you should change your PHP script which is using the POST method. If you change the CURLOPT_POST to false, the PHP script should work.

提交回复
热议问题