php and curl http headers
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.
Re: php and curl http headers
Quote:
Originally Posted by
drfool
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()...
PHP Code:
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/html'));
Re: php and curl http headers
Quote:
Originally Posted by
PeejAvery
:confused: Which is exactly how you use
curl_setopt()...
PHP Code:
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.
Re: php and curl http headers
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?