PHP - Debugging Curl

后端 未结 8 1327
無奈伤痛
無奈伤痛 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:14

    Here is a simpler code for the same:

       curl_setopt($ch, CURLOPT_VERBOSE, 1);
       curl_setopt($ch, CURLOPT_STDERR, $fp);
    

    where $fp is a file handle to output errors. For example:

       $fp = fopen(dirname(__FILE__).'/errorlog.txt', 'w');
    

    ( Read on http://curl.haxx.se/mail/curlphp-2008-03/0064.html )

提交回复
热议问题