PHP - Debugging Curl

后端 未结 8 1331
無奈伤痛
無奈伤痛 2020-11-21 11:35

I\'d like to see what the post fields in the request are before I send it. (For debugging purposes).

The PHP library (class) I am using is already made (not by me),

8条回答
  •  日久生厌
    2020-11-21 12:13

    Another (crude) option is to utilize netcat for dumping the full request:

    nc -l -p 8000 -w 3 | tee curldbg.txt
    

    And of course sending the failing request to it:

    curl_setup(CURLOPT_URL, "http://localhost/testytest");
    

    Notably that will always hang+fail, since netcat won't ever construct a valid HTTP response. It's really just for inspecting what really got sent. The better option, of course, is using a http request debugging service.

提交回复
热议问题