Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:25:04+00:00 2026-06-14T11:25:04+00:00

I am do some curl process, some site must set CURLOPT_HEADER, true , so

  • 0

I am do some curl process, some site must set CURLOPT_HEADER, true, so that could get the html code.

$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL, $url);
curl_setopt($ch2, CURLOPT_HEADER, true);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch2);
curl_close($ch2);
echo $html;

the return data like:

HTTP/1.0 200 OK  Date: Wed, 14 Nov 2012 17:58:26 GMT  Expires: Wed, 14 Nov 2012 18:08:26 GMT  Cache-Control: max-age=600... 
<html...

So how to remove some data before <html>(The CURLOPT_HEADER return data: HTTP/1.0 200 OK…)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:25:06+00:00Added an answer on June 14, 2026 at 11:25 am

    CURLOPT_HEADER does not affect what the site returns to you. You can remove it and if you get empty content back – then something else is wrong.

    CURLOPT_HEADER is just for your convenience so you can see what the server said back to your script. Some web API’s pass data in the headers and this allows you to access it.

    You can split the content from the header like this

    list($header, $body) = explode("\r\n\r\n", $content, 2); // Notice the "2" limit!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My cUrl call is returning HTML code like: &quot;Some stuff.&quot; and I'd like to
I want to create a cURL request in some C++ code which will get
I'm using curl to fetch some data from a website. After I process it
I am doing some json parsing in a bash script: curl http://myurl.com/get.json | sed
I'm using curl in PHP to check the HTTP code when requesting some files,
I need to get one page (can be cURL, or filegetcontent), get some info
So I've been using CURL to get some portions of remote images....but then depending
I need a time delay between each cURL call so that one process do
Here's a small sample of some test code that simply goes to http://www.un.org/apps/news/story.asp?NewsID=37180&Cr=Haiti&Cr1= and
I am using a API to get some data from curl. Response i get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.