0

Is there a way how to output in a browser everything that curl is sending to the remote api url? Headers, settings just everything. I understand that in the shown code only $url and $headers are the data which transferred as the request. HTTPS is not used. I would like to go as i used a TCP sniffer for grabbing traffic.

$ch = curl_init();
$url = self::API_URL . $data['request']; // https://api.bitfinex.com/v1/account_infos

$headers = $this->prepare_header($data);

curl_setopt_array($ch, array(
    CURLOPT_URL             => $url,
    CURLOPT_POST            => TRUE,
    CURLOPT_RETURNTRANSFER  => TRUE,
    CURLOPT_HTTPHEADER      => $headers,
    CURLOPT_SSL_VERIFYPEER  => TRUE,
    CURLOPT_CONNECTTIMEOUT  => self::CONNECT_TIMEOUT,
    CURLOPT_POSTFIELDS      => ''
));
1

1 Answer 1

1

there is no (feasable) way to get all active settings, the closest you can get is var_dump(curl_getinfo($ch)); - as for dumping all headers, do curl_setopt($ch,CURLOPT_VERBOSE,1);, this will dump both all outgoing and incoming headers, but be aware that due to PHP bug #65348, setting CURLOPT_VERBOSE will break CURLINFO_HEADER_OUT.. (you can work around it by parsing the VERBOSE output, but it aint pretty)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.