Matthew Vaccaro

Coordinator of Internets
  • Index
  • Blog
  • Snippets
  • cURL Debug Code

    Using cURL is tons of fun (not), but if you have to do it, some basic debugging can be helpful to see if your MIME types, effective URL, and file size are coming in correctly. I used these lines to do view some cURL information while working with it.

    echo ‘Req URL: ‘.curl_getinfo($ch, CURLINFO_EFFECTIVE_URL).’<br/>’;
    echo ‘Time: ‘.curl_getinfo($ch, CURLINFO_TOTAL_TIME).’<br/>’;
    echo ‘Req Size: ‘.curl_getinfo($ch, CURLINFO_REQUEST_SIZE).’<br/>’;
    echo ‘C-Type: ‘.curl_getinfo($ch, CURLINFO_CONTENT_TYPE).’<br/>’;

    Go Back