【问题标题】:after curl post, how to check the postfield - to debugcurl post后,如何检查postfield - 调试
【发布时间】:2016-11-25 20:46:29
【问题描述】:

我有一个类似这样的卷曲帖子

curl_setopt($ch, CURLOPT_URL,$cpUrl);
curl_setopt($ch, CURLOPT_POST, true);  
curl_setopt($ch, CURLOPT_POSTFIELDS, $varpost); // post parameters
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return the output in string format
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_NOBODY, true);
$output = curl_exec ($ch); // Execute

如何在 curl_close ($ch) 之后检查;发送了哪些帖子字段变量?请帮忙

【问题讨论】:

    标签: php debugging post curl


    【解决方案1】:

    如何在 curl_close ($ch) 之后检查;后字段变量是什么 发送了吗?

    您的脚本提供了使用CURLOPT_POSTFIELDS 选项发送的变量,因此如果 cURL 成功执行,您已经拥有这些变量:

    ...
    $output = curl_exec($ch); // Execute
    
    //show the POST fields if they were sent successfully
    if($output) print_r($varpost);
    else echo "cURL failed: no POST fields sent";
    

    【讨论】:

    • 当我显示为 .....$output = curl_exec ($ch); 时它显示为空$rr= curl_getinfo($ch, CURLOPT_POSTFIELDS); info("paramspassed:",$rr); @beetleJuice
    • @Ps-kl 我不明白你为什么这么说;我不建议你使用curl_getinfo。此外,您不能使用 curl_getinfoCURLOPT_POSTFIELDS 作为第二个参数。请参阅文档了解允许的内容:php.net/manual/en/function.curl-getinfo.php
    【解决方案2】:

    您可以使用Fiddler 检查客户端和服务器之间实际传输的数据

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-17
      • 1970-01-01
      • 2017-05-25
      相关资源
      最近更新 更多