debugging - What Steps do you Take to Troubleshoot Problems with PHP cURL? -


Almost any working PHP programmer has to face using curl to send raw HTTP requests This is for the credit card payment process, between negligible screen scraps or some things.

In almost any forum where PHP programmers are gathered, there are a large number of people.

When curl is not working for you, then what is the problem solving technique, do you use to understand why it is not working? What's the weird disturbance with PHP's curl implementation? If a forum asks "HALP My Curl IZ Broken" on a forum, then what steps have been taken to ascertain their steps, why their request is not working?

I find the option CURLINFO_HEADER_OUT to be very useful.

 & lt ;? Php $ curl = curl_init ('http://www.php.net'); Curl_setopt ($ curl, CURLOPT_HEADERFUNCTION, 'dbg_curl_data'); Curl_setopt ($ curl, CURLOPT_WRITEFUNCTION, 'dbg_curl_data'); Curl_setopt ($ curl, CURLINFO_HEADER_OUT, true); Curl_exec ($ curl); Echo & lt; Fieldset & gt; & Lt; Legend & gt; Request header & lt; / Legend & gt; & Lt; Pre & gt; ', Htmlspecialchars (curl_getinfo ($ curl, CURLINFO_HEADER_OUT),' & lt; / Pre & gt; & Lt; / Fieldset & gt; '; Echo & lt; Fieldset & gt; & Lt; Legend & gt; Feedback & lt; / Legend & gt; & Lt; Pre & gt; ', Htmlspecialchars (dbg_curl_data),' & lt; / Pre & gt; & Lt; / Fieldset & gt; '; Function dbg_curl_data ($ curl, $ data = zero) {static $ buffer = ''; If (is_null ($ curl)) {$ r = $ buffer; $ Buffer = ''; Return $ R; } And {$ buffer. = $ Data; Return Stellon ($ data); }} 

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -