0%

【PHP】去除curl请求结果中的header信息,保留body信息

1
2
3
4
5
$result = curl_exec($curl);
if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') {
$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); //获取header长度
$bodyInfo = substr($result, $headerSize); //截取掉header
}