开发者

Why twitter 'status->content' i.e. timeline is saved very odd into mysql?

开发者 https://www.devze.com 2023-01-26 21:33 出处:网络
My app saves tweets into mysql. But the contents of \'$status->content\' i.e. tweet message are not saved as they appear if outputted. Other values like \'?->author->name\' and \'?->id\' are saved as

My app saves tweets into mysql. But the contents of '$status->content' i.e. tweet message are not saved as they appear if outputted. Other values like '?->author->name' and '?->id' are saved as they appear. This is how a tweet msg i.e. '$status->content' look like when I display tables results;

<a href="http://search.twitter.com/search?q=%23DIYse_D" onclick="pageTra
cker._setCustomVar(2, 'result_type', 'recent', 3);pageTracker._trackPageview('/i
ntra/hashtag/#DIYse_D');"><b>#DIYse_D</b></a>  D

The results are returned as xml object from my php function & I fetch value开发者_JS百科s of these properties from it.


It's most likely because there is HTML (with a page tracker) in the content. If you look at the original results source, you can see that "status" has a type of "html".

Use:

$clean_content = strip_tags($status->content);

To remove HTML tags and obtain only the text.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号