Click to See Complete Forum and Search --> : php and curl http headers


drfool
November 12th, 2009, 09:58 PM
I'm doing some work in php with curl. Specifically I need to specify the http header used in a request.

I know I can curl_setopt alot of header values, but what I'm really interested in is specifying the header myself with a string or an array or something. How would I go about specifying the header manually?

Thank you.

PeejAvery
November 13th, 2009, 08:14 AM
I know I can curl_setopt alot of header values, but what I'm really interested in is specifying the header myself with a string or an array or something.
:confused: Which is exactly how you use curl_setopt()...

curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/html'));

drfool
November 13th, 2009, 12:21 PM
:confused: Which is exactly how you use curl_setopt()...

curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/html'));

Can somebody give me a good example of the use of CURLOPT_HTTPHEADER, in my experiments of trying to specify the entire header in that way, I've not been able to recieve an identical response from the remote server to what the response is to a browser, despite the fact that I had supposedly set the header to exactly what the browser sent. This leads me to believe that despite the fact that I'm specifying the header with CURLOPT_HTTPHEADER that curl was using information other than or extra to what I was specifying. Are there other hoops I have to jump through, like explicity tell curl not to use anything other than or add anything to what I specified?

What I really need is a sure-fire way to specify the header EXACTLY to a string without curl appending or prepending or inserting ANYTHING into the actual header that it sends.

PeejAvery
November 13th, 2009, 09:15 PM
What kind of header information are you trying to send? What does this have to be so specific? Does the remote host you are attempting to communicate require a specific header?