开发者

What is an easy way to store tweets into database?

I have a php function that retrieves tweets from Twitter & returns them in simplexml_load_string. I have to store those into database. Whats is an easy way to store those into database on page load? I have already tried my luck with ajax but json that is returned from twitter seems invalid.开发者_开发技巧 thanX a Lot in advance.


Simply store them in the table as XML and then parse them on demand.

// perform query
$res = mysql_query('SELECT * from tweets');

// place xml objects into array
$tweets = array();
while ($row = mysql_fetch_assoc($res)) {
    $tweets[] = new SimpleXMLElement($row['data']);
}

SimpleXML

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜