Php - 调试卷曲 [英] Php - Debugging Curl

查看:111
本文介绍了Php - 调试卷曲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在发送请求之前查看其中的帖子字段。 (为了调试的目的)。



我使用的php库(类)已经做了(不是我),所以我试图理解它。 / p>

据我所知,它使用 curl_setopt()来设置不同的选项,如头等,然后它使用 curl_exec()发送请求。



关于如何查看发送什么帖子字段的想法? / p>

解决方案

您可以启用 CURLOPT_VERBOSE 选项:

  curl_setopt($ curlhandle,CURLOPT_VERBOSE,true); 

当设置 CURLOPT_VERBOSE STDERR 或使用 CURLOPT_STDERR 指定的文件。



您也可以使用tcpdump或wireshark来观看网络流量。


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'm using is already made (not by me), so I'm trying to understand it.

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?

解决方案

You can enable the CURLOPT_VERBOSE option:

curl_setopt($curlhandle, CURLOPT_VERBOSE, true);

When CURLOPT_VERBOSE is set, output is written to STDERR or the file specified using CURLOPT_STDERR. The output is very informative.

You can also use tcpdump or wireshark to watch the network traffic.

这篇关于Php - 调试卷曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆