I'm sending this response:
$item_collections = array('@type' => 'http://activitystrea.ms/2.0/Collection',
'objectID' => $stream_collections->objectID,
'owner' => array('globalID'=>$stream_collections->owner),
'items'=>array());
foreach($stream_collections->streamitem as $Item){
$items = array('item'=>array(
'objectID' => $Item->objectID,
'targetID' => $Item->targetID,
'owner' =>$Item->owner,
'author' => array($Item->author),
'@type' => 'Post',
'published' => $Item->published,
'actor' => array('@type'=>'Person',
'displayName'=>$Item->person->displayName),
'object' => array('@type'=>'Note',
'displayName'=>$Item->text)),
'comments'=>$Item->comment,
'likes'=>$Item->like,
'tags'=>array(),
);
array_push($item_collections['items'], $items);
} return response($item_collections)
so if the $Item->comment
or $Item->like
has more than 6 comments or likes the body of the response will have some extra break lines, letters and numbers.
On the client side I'm trying to get the body using:
list($header, $body) = explode("
", $response, 2);
When i print the $body
I get the extra break lines and letters like this:
9201
{\"@type\":\".........}
0
I don't know where 9201
and 0
came from. If the response is not large everything will work fine! Does anyone have an idea why this happens?