Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts

    cURL response header showing up in output

    I am trying to fetch a simple CSV text file using cURL in PHP. When I download it using my browser the file contacts the comma seperated values I expect. When I download it using cURL I get the following prepended onto the data returned:
    Code:
    HTTP/1.1 200 OK
    Date: Sun, 30 Apr 2006 21:37:11 GMT
    Server: Apache/2.0.51 (Fedora)
    Last-Modified: Sun, 30 Apr 2006 04:23:36 GMT
    Accept-Ranges: bytes
    Content-Length: 46586
    Connection: close
    Content-Type: text/plain
    This messes up fgetcsv() so I need to get rid of that response header. I have tried setting CURLOPT_HEADER to 0 but it still prepends the data. What option do I need to set in cURL to prevent this internet response header from being prepended to the data returned by curl_exec()?

    By the way, CURLOPT_RETURNTRANSFER is set to 1.

  • #2
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Nevermind. Found out that a value of "0" will not work for CURLOPT_HEADER. It must be boolean FALSE.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •