" ; // 使用htmlspecialchars防止XSS攻击} else { echo "回车或点查询,再点看下面相关想了解的链接,精彩从这里开始。
";} $url ="http://ddx.gubit.cn/gpzd.php?code=$code" ; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);// 设置请求头,模拟浏览器访问 $headers = [ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" ]; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $html = curl_exec($ch); curl_close($ch); $dom = new DOMDocument(); @$dom->loadHTML($html); $title = $dom->getElementsByTagName('div')->item(0)->nodeValue; $result = preg_replace_callback('/DDX:(\d+(\.\d+)?)/', function($matches) { // 将找到的数字放大10倍 return 'DDX:' . ($matches[1] * 10); }, $title); $malhj =preg_replace("/DDX:/i", "
拉升意愿:",$result); echo preg_replace("/BBD:/i", "
主力增仓:",$malhj)." 本数据由MALHJ智能生成,仅供浏览,5分钟更新一次,请勿据此操作,风险自担!"; $rssurl = "https://www.chinanews.com.cn/rss/world.xml";$xml = simplexml_load_file($rssurl);foreach ($xml->channel->item as $item) { $title = (string) $item->title; $description = (string) $item->description; $link =(string) $item->link; $pubDate = (string) $item->pubDate; }$rsurl = "https://www.chinanews.com.cn/rss/scroll-news.xml";$xml= simplexml_load_file($rsurl);foreach ($xml->channel->item as $item) { $titl = (string) $item->title; $description = (string) $item->description; $link =(string) $item->link; $pubDate = (string) $item->pubDate; } ?>
每时每刻热点新闻:《{$title}》《{$titl}》