Explode does not separate line correctly
I am getting below the line using cURL. The code can be found in this comment .
HTTP/1.1 200 OK ID=347 Date: Tue, 19 Feb 2013 09:15:25 GMT Server:
Apache/2.2.22 (Ubuntu) Content-length: 0 Vary: Accept-Encoding
Content-Type: text/plain; charset=ISO-8859-1
Now I want an ID from a string and for that I used explode to create an array from a space as shown below:
$getIdElem = explode(' ',$output);
echo '<pre>';print_r($getIdElem);
but I am getting Date: with id string and space before it. Array print output:
Array
(
[0] => HTTP/1.1
[1] => 200
[2] => OK
[3] => ID=347
Date:
[4] => Tue,
[5] => 19
[6] => Feb
[7] => 2013
[8] => 09:15:25
[9] => GMT
Server:
[10] => Apache/2.2.22
[11] => (Ubuntu)
Content-length:
[12] => 0
Vary:
[13] => Accept-Encoding
Content-Type:
[14] => text/plain;
[15] => charset=ISO-8859-1
)
I don't understand why it doesn't include this space in the break function. Can anyone help me with this?
+3
user2031602
source
to share