You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method of splitting the response data by a double \r\n starting at line 175 to get the response-headers and data in one request is by far not ideal.
$response_headers = [];
// this function is called by curl for each header received
curl_setopt($ch, CURLOPT_HEADERFUNCTION,
function($curl, $header) use (&$response_headers)
{
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) // ignore invalid headers
return $len;
$headers[strtolower(trim($header[0]))][] = trim($header[1]);
return $len;
}
);
...
$response_content = curl_exec($ch);
The text was updated successfully, but these errors were encountered:
The method of splitting the response data by a double \r\n starting at line 175 to get the response-headers and data in one request is by far not ideal.
Since then, there was a bit evolution on this topic, so i want to link you to the
proper solution for cUrl to retrieve response headers AND body in a single request and based on it, i changed the code sample below to your variable namings:
...
The text was updated successfully, but these errors were encountered: