CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008
    Posts
    13

    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.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: php and curl http headers

    Quote Originally Posted by drfool View Post
    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($curlCURLOPT_HTTPHEADER, array('Content-Type: application/html')); 
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Oct 2008
    Posts
    13

    Re: php and curl http headers

    Quote Originally Posted by PeejAvery View Post
    Which is exactly how you use curl_setopt()...

    PHP Code:
    curl_setopt($curlCURLOPT_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.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    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
  •  





Click Here to Expand Forum to Full Width

Featured