|
-
November 12th, 2009, 10:58 PM
#1
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.
-
November 13th, 2009, 09:14 AM
#2
Re: php and curl http headers
 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.
Which is exactly how you use curl_setopt()...
PHP Code:
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/html'));
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 13th, 2009, 01:21 PM
#3
Re: php and curl http headers
 Originally Posted by PeejAvery
 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.
-
November 13th, 2009, 10:15 PM
#4
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?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|