PHP - 调试卷曲 [英] PHP - Debugging Curl
问题描述
我想在发送之前查看请求中的帖子字段是什么.(用于调试目的).
I'd like to see what the post fields in the request are before I send it. (For debugging purposes).
我正在使用的 PHP 库(类)已经制作好了(不是我制作的),所以我正在尝试理解它.
The PHP library (class) I am using is already made (not by me), so I am trying to understand it.
据我所知,它使用 curl_setopt()
来设置不同的选项,如标头等,然后它使用 curl_exec()
发送请求.
As far as I can tell, it uses curl_setopt()
to set different options like headers and such and then it uses curl_exec()
to send the request.
关于如何查看正在发送的帖子字段的想法?
Ideas on how to see what post fields are being sent?
推荐答案
您可以启用 CURLOPT_VERBOSE
选项:
curl_setopt($curlhandle, CURLOPT_VERBOSE, true);
当设置了 CURLOPT_VERBOSE
时,输出将写入 STDERR 或使用 CURLOPT_STDERR
指定的文件.输出内容非常丰富.
When CURLOPT_VERBOSE
is set, output is written to STDERR or the file specified using CURLOPT_STDERR
. The output is very informative.
您还可以使用 tcpdump 或 wireshark 来监视网络流量.
You can also use tcpdump or wireshark to watch the network traffic.
这篇关于PHP - 调试卷曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!