源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

php 获取百度的热词数据的代码

  • 时间:2021-06-10 14:07 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:php 获取百度的热词数据的代码
[u]复制代码[/u] 代码如下:
<?php /** * 获取百度的热词 * @user 小杰 * @from http://www.isharey.com/?p=354 * @return array 返回百度的热词数据(数组返回) */ function getBaiduHotKeyWord() { $templateRss = file_get_contents('http://top.baidu.com/rss_xml.php?p=top10'); If (preg_match('/<table>(.*)<\/table>/is', $templateRss, $_description)) { $templateRss = $_description [0]; $templateRss = str_replace("&", "&", $templateRss); } $templateRss = "<?xml version=\"1.0\" encoding=\"GBK\"?>" . $templateRss; $xml = simplexml_load_String($templateRss); foreach ($xml->tbody->tr as $temp) { if (!empty ($temp->td->a)) { $keyArray [] = trim(($temp->td->a)); } } return $keyArray; } print_r(getBaiduHotKeyWord());
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部