From 257c255e4eae4b30c908ef31ff54e47104550b15 Mon Sep 17 00:00:00 2001 From: bangbang93 Date: Mon, 28 Apr 2014 18:38:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20HTTP=20301=20=E5=AF=BC=E8=87=B4$response?= =?UTF-8?q?=E5=86=85=E6=9C=89header=20$response=5Fheader=20=3D=20'HTTP=203?= =?UTF-8?q?01...';=20$response=20=3D=20'HTTP=20200.....';?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Curl.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Curl.class.php b/src/Curl.class.php index d8c5c50..91810ab 100644 --- a/src/Curl.class.php +++ b/src/Curl.class.php @@ -283,7 +283,14 @@ class Curl { $response_headers = ''; if (!(strpos($response, "\r\n\r\n") === false)) { - list($response_header, $response) = explode("\r\n\r\n", $response, 2); + $response_array = (explode("\r\n\r\n", $response)); + for($i = count($response_array) - 1; $i>=0 ;$i--){ + if (stripos($response_array[$i],'HTTP') === 0){ + $response_header = $response_array[$i]; + $response = implode("\r\n\r\n", array_splice($response_array, $i+1)); + break; + } + } $response_headers = explode("\r\n", $response_header); if (in_array('HTTP/1.1 100 Continue', $response_headers)) { list($response_header, $response) = explode("\r\n\r\n", $response, 2);