0

i use curl to get the data (http request) from a website through php. and some of the information of the data is stored inside the header information. i can simply fetch the data using curl_exec, but if i try to fetch the header information using curl_getinfo, the information is missing. it supposed to be worked just like ajax. can somebody help me with this?

1 Answer 1

1

curl_getinfo doesn't give you the headers, it just gives meta information about the last request. The CURLOPT_HEADER options makes sure the headers are included in the output:

...
curl_setopt($c, CURLOPT_HEADER, true);
$data = curl_exec($c);

list($headers, $body) = explode("\n\n", $data, 2);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.