如何从包含 HTML 代码的数组元素中提取特定部分并使用提取的内容创建一个新数组?
How to extract specific parts from the array element that contains HTML code and create a new array with this extracted content?
我有一系列标题为 $comments
的评论。实际的数组可能很大,可能包含数百个这样的元素。为了您的理解,我只添加了 10 个元素,如下所示:
Array
(
[0] => Array
(
[text] => Second Comment Added
)
[1] => Array
(
[text] => This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page
)
[2] => Array
(
[text] => This comment is of two lines need to check more about it
)
[3] => Array
(
[text] => This comment is of two lines need to check more
)
[4] => Array
(
[text] => Uploading Photo for comment <div title="comment_attach_image">
<a title="" title="colorbox" href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" ><img src="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" height="150px" width="150px" /></a>
<a href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" class="comment_attach_image_link_dwl">Download</a>
</div>
)
[5] => Array
(
[text] => test
)
[6] => Array
(
[text] => Amit's pic<div class="comment_attach_image">
<a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" ><img src="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" height="150px" width="150px" /></a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_e55f0f3080eb9828270a7963648a5826.jpeg" >Download</a>
</div>
)
[7] => Array
(
[text] => PDF file added<div class="comment_attach_file">
<a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a>
<a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a>
</div>
)
[8] => Array
(
[text] => Just did it...
)
[9] => Array
(
[text] => Profile photo uploaded<div class="comment_attach_image">
<a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" ><img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" /></a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a>
</div>
)
)
现在我想要实现的是根据上述数组的键 [text]
中包含的值来识别评论的类型。
让我用例子来解释你。让我们考虑以下一个元素 $comments[9][text]
它包含以下值(即 HTML 代码):
Profile photo uploaded<div class="comment_attach_image">
<a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" ><img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" /></a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a>
</div>
我想从此 HTML 数据中提取的第一件事是字符串 <div class="comment_attach_image">
的结尾字符串。
换句话说,我想从字符串 <div class="comment_attach_image">
中提取单词 image。这将表明此评论的类型为 image。
然后我只想要图像的 URL,即 http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
(<img>
的 src 属性的值)。
现在这两个值都应该插入到一个新数组中,键类型为 URL,如下所示:
Array
(
[9] => Array
(
[type] => image
[URL] => http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
[text] =>
)
)
同样的事情应该发生在另一个数组元素 $comments[7][text]
上,它不是图像类型而是文件类型,如下所示:
它包含以下值(即 HTML 代码):
PDF file added<div class="comment_attach_file">
<a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a>
<a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a>
</div>
我想从此 HTML 数据中提取的第一件事是字符串 <div class="comment_attach_file">
的结尾字符串。
换句话说,我想从字符串 <div class="comment_attach_file">
中提取单词 file。这将表明此注释的类型为 file。
然后我只想要文件的 URL,即 http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf
(<a>
的 hre 属性的值)。
现在这两个值都应该插入到一个新数组中,键类型为 URL,如下所示:
Array
(
[9] => Array
(
[type] => file
[URL] => http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf
[text] =>
)
)
对于不包含任何 HTML 的其他元素,即包含简单文本,应该不会发生任何事情。对于他们来说,新数组中的条目应该如下所示:
让我们考虑元素 $comments[0][text]
它包含以下值:
Second Comment Added
因此新数组中的条目应如下所示:
Array
(
[0] => Array
(
[type] => text
[URL] =>
[text] => Second Comment Added
)
)
以这种方式,包含评论类型及其内容的新数组应该以高效的方式生成。
有人可以在这方面帮助我吗?
如果您对我面临的问题有任何疑问,请告诉我。
如有任何帮助,我们将不胜感激。
提前致谢。
等待您宝贵的回复。
最终需要的数组应该如下:
Array
(
[0] => Array
(
[type] => text
[URL] =>
[text] => Second Comment Added
)
[1] => Array
(
[type] => text
[URL] =>
[text] => This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page
)
[2] => Array
(
[type] => text
[URL] =>
[text] => This comment is of two lines need to check more about it
)
[4] => Array
(
[type] => image
[URL] => https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4
[text] => Uploading Photo for comment
)
[5] => Array
(
[type] => text
[URL] =>
[text] => test
)
[6] => Array
(
[type] => image
[type] => text
[URL] => http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg
[text] => Amit's pic
)
[7] => Array
(
[type] => file
[URL] => http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf
[text] =>
)
[8] => Array
(
[type] => text
[URL] =>
[text] => Just did it...
)
[9] => Array
(
[type] => image
[URL] => http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
[text] => PDF file added
)
)
$comments = array(
array(
'text' => 'Second Comment Added'
),
array(
'text' => 'This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page'
),
array(
'text' => 'This comment is of two lines need to check more about it'
),
array(
'text' => 'This comment is of two lines need to check more '
),
array(
'text' => 'Uploading Photo for comment <div title="comment_attach_image"><a title="" title="colorbox" href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" ><img src="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" height="150px" width="150px" /></a><a href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" class="comment_attach_image_link_dwl">Download</a></div>'
),
array(
'text' => 'test'
),
array(
'text' => 'Amit's pic<div class="comment_attach_image"><a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" ><img src="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" height="150px" width="150px" /></a><a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_e55f0f3080eb9828270a7963648a5826.jpeg" >Download</a></div>'
),
array(
'text' => 'PDF file added<div class="comment_attach_file"><a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a><a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a></div>'
),
array(
'text' => 'Just did it...'
),
array(
'text' => 'Profile photo uploaded<div class="comment_attach_image"><a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" ><img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" /></a><a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a></div>'
)
);
$newArray = array();
foreach($comments as $comment) {
$text = strstr($comment['text'], '<div');
if (strlen($text) <= 0) {
$newArray[] = array(
'type' => 'text',
'url' => '',
'text' => $comment['text']
);
} else if($xml = @simplexml_load_string($text)) {
$newArray[] = array(
'type' => substr(strrchr($xml['class'], '_'), 1),
'url' => $xml->a['href']->asXML(),
'text' => strtok($comment['text'], '<')
);
} else {
continue;
};
}
var_dump($newArray);
输出:
array (size=9)
0 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'Second Comment Added' (length=20)
1 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page' (length=154)
2 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'This comment is of two lines need to check more about it' (length=56)
3 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'This comment is of two lines need to check more ' (length=48)
4 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'test' (length=4)
5 =>
array (size=3)
'type' => string 'image' (length=5)
'url' => string ' href="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg"' (length=88)
'text' => string '' (length=0)
6 =>
array (size=3)
'type' => string 'file' (length=4)
'url' => string ' href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf"' (length=101)
'text' => string '' (length=0)
7 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'Just did it...' (length=14)
8 =>
array (size=3)
'type' => string 'image' (length=5)
'url' => string ' href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png"' (length=87)
'text' => string '' (length=0)
我有一系列标题为 $comments
的评论。实际的数组可能很大,可能包含数百个这样的元素。为了您的理解,我只添加了 10 个元素,如下所示:
Array
(
[0] => Array
(
[text] => Second Comment Added
)
[1] => Array
(
[text] => This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page
)
[2] => Array
(
[text] => This comment is of two lines need to check more about it
)
[3] => Array
(
[text] => This comment is of two lines need to check more
)
[4] => Array
(
[text] => Uploading Photo for comment <div title="comment_attach_image">
<a title="" title="colorbox" href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" ><img src="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" height="150px" width="150px" /></a>
<a href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" class="comment_attach_image_link_dwl">Download</a>
</div>
)
[5] => Array
(
[text] => test
)
[6] => Array
(
[text] => Amit's pic<div class="comment_attach_image">
<a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" ><img src="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" height="150px" width="150px" /></a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_e55f0f3080eb9828270a7963648a5826.jpeg" >Download</a>
</div>
)
[7] => Array
(
[text] => PDF file added<div class="comment_attach_file">
<a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a>
<a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a>
</div>
)
[8] => Array
(
[text] => Just did it...
)
[9] => Array
(
[text] => Profile photo uploaded<div class="comment_attach_image">
<a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" ><img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" /></a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a>
</div>
)
)
现在我想要实现的是根据上述数组的键 [text]
中包含的值来识别评论的类型。
让我用例子来解释你。让我们考虑以下一个元素 $comments[9][text]
它包含以下值(即 HTML 代码):
Profile photo uploaded<div class="comment_attach_image">
<a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" ><img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" /></a>
<a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a>
</div>
我想从此 HTML 数据中提取的第一件事是字符串 <div class="comment_attach_image">
的结尾字符串。
换句话说,我想从字符串 <div class="comment_attach_image">
中提取单词 image。这将表明此评论的类型为 image。
然后我只想要图像的 URL,即 http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
(<img>
的 src 属性的值)。
现在这两个值都应该插入到一个新数组中,键类型为 URL,如下所示:
Array
(
[9] => Array
(
[type] => image
[URL] => http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
[text] =>
)
)
同样的事情应该发生在另一个数组元素 $comments[7][text]
上,它不是图像类型而是文件类型,如下所示:
它包含以下值(即 HTML 代码):
PDF file added<div class="comment_attach_file">
<a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a>
<a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a>
</div>
我想从此 HTML 数据中提取的第一件事是字符串 <div class="comment_attach_file">
的结尾字符串。
换句话说,我想从字符串 <div class="comment_attach_file">
中提取单词 file。这将表明此注释的类型为 file。
然后我只想要文件的 URL,即 http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf
(<a>
的 hre 属性的值)。
现在这两个值都应该插入到一个新数组中,键类型为 URL,如下所示:
Array
(
[9] => Array
(
[type] => file
[URL] => http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf
[text] =>
)
)
对于不包含任何 HTML 的其他元素,即包含简单文本,应该不会发生任何事情。对于他们来说,新数组中的条目应该如下所示:
让我们考虑元素 $comments[0][text]
它包含以下值:
Second Comment Added
因此新数组中的条目应如下所示:
Array
(
[0] => Array
(
[type] => text
[URL] =>
[text] => Second Comment Added
)
)
以这种方式,包含评论类型及其内容的新数组应该以高效的方式生成。
有人可以在这方面帮助我吗?
如果您对我面临的问题有任何疑问,请告诉我。
如有任何帮助,我们将不胜感激。
提前致谢。
等待您宝贵的回复。
最终需要的数组应该如下:
Array
(
[0] => Array
(
[type] => text
[URL] =>
[text] => Second Comment Added
)
[1] => Array
(
[type] => text
[URL] =>
[text] => This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page
)
[2] => Array
(
[type] => text
[URL] =>
[text] => This comment is of two lines need to check more about it
)
[4] => Array
(
[type] => image
[URL] => https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4
[text] => Uploading Photo for comment
)
[5] => Array
(
[type] => text
[URL] =>
[text] => test
)
[6] => Array
(
[type] => image
[type] => text
[URL] => http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg
[text] => Amit's pic
)
[7] => Array
(
[type] => file
[URL] => http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf
[text] =>
)
[8] => Array
(
[type] => text
[URL] =>
[text] => Just did it...
)
[9] => Array
(
[type] => image
[URL] => http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png
[text] => PDF file added
)
)
$comments = array(
array(
'text' => 'Second Comment Added'
),
array(
'text' => 'This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page'
),
array(
'text' => 'This comment is of two lines need to check more about it'
),
array(
'text' => 'This comment is of two lines need to check more '
),
array(
'text' => 'Uploading Photo for comment <div title="comment_attach_image"><a title="" title="colorbox" href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" ><img src="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" height="150px" width="150px" /></a><a href="https://www.filepicker.io/api/file/CnYTVQdATAOQTkMxpAq4" class="comment_attach_image_link_dwl">Download</a></div>'
),
array(
'text' => 'test'
),
array(
'text' => 'Amit's pic<div class="comment_attach_image"><a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" ><img src="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg" height="150px" width="150px" /></a><a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_e55f0f3080eb9828270a7963648a5826.jpeg" >Download</a></div>'
),
array(
'text' => 'PDF file added<div class="comment_attach_file"><a class="comment_attach_file_link" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >1b87d4420c693f2bbdf738cbf2457d89.pdf</a><a class="comment_attach_file_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf" >Download</a></div>'
),
array(
'text' => 'Just did it...'
),
array(
'text' => 'Profile photo uploaded<div class="comment_attach_image"><a class="group1 cboxElement" href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" ><img src="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png" height="150px" width="150px" /></a><a class="comment_attach_image_link_dwl" href="http://52.1.47.143/feed/download/year_2015/month_03/file_a4ea5532b83a56bbbae2fffc80de4fee.png" >Download</a></div>'
)
);
$newArray = array();
foreach($comments as $comment) {
$text = strstr($comment['text'], '<div');
if (strlen($text) <= 0) {
$newArray[] = array(
'type' => 'text',
'url' => '',
'text' => $comment['text']
);
} else if($xml = @simplexml_load_string($text)) {
$newArray[] = array(
'type' => substr(strrchr($xml['class'], '_'), 1),
'url' => $xml->a['href']->asXML(),
'text' => strtok($comment['text'], '<')
);
} else {
continue;
};
}
var_dump($newArray);
输出:
array (size=9)
0 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'Second Comment Added' (length=20)
1 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'This is the long comment added to check thwe size of the comment on the device,if the size is more then add the hyperlink button to go on to the next page' (length=154)
2 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'This comment is of two lines need to check more about it' (length=56)
3 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'This comment is of two lines need to check more ' (length=48)
4 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'test' (length=4)
5 =>
array (size=3)
'type' => string 'image' (length=5)
'url' => string ' href="http://52.1.47.143/file/attachment/2015/03/e55f0f3080eb9828270a7963648a5826.jpeg"' (length=88)
'text' => string '' (length=0)
6 =>
array (size=3)
'type' => string 'file' (length=4)
'url' => string ' href="http://52.1.47.143/feed/download/year_2015/month_03/file_1b87d4420c693f2bbdf738cbf2457d89.pdf"' (length=101)
'text' => string '' (length=0)
7 =>
array (size=3)
'type' => string 'text' (length=4)
'url' => string '' (length=0)
'text' => string 'Just did it...' (length=14)
8 =>
array (size=3)
'type' => string 'image' (length=5)
'url' => string ' href="http://52.1.47.143/file/attachment/2015/03/a4ea5532b83a56bbbae2fffc80de4fee.png"' (length=87)
'text' => string '' (length=0)