English 中文(简体)
我的网页上原xml等古角度新闻,如何适当反映rs子的内容?
原标题:how to echo properly the content of rss xml from google news like the original xml in my page?

我将这一守则用于在我的网站上展示大消息,但我总是看到它所展示的每份新闻,我不知道为什么会发生,有人会帮助吗?

$xml = simplexml_load_file( https://news.google.com.mx/news/feeds?hl=es&gl=mx&q=realmadrid&um=1&ie=UTF-8&output=rss );
print_r($xml);
foreach ($xml as $status) {

$description = $status->item->description;


echo "$description <br> ";

}

我在展示每份新闻后,总是会这样做,我知道,我正在使用印刷版,但没有印刷版面显示信封新闻。

SimpleXMLElement Object ( [@attributes] => Array ( [version] => 2.0 ) [channel] => SimpleXMLElement Object ( [generator] => NFE/1.0 [title] => realmadrid: Google Noticias [link] => http://news.google.com.mx/news?gl=mx&pz=1&ned=es_mx&hl=es&q=realmadrid [language] => es [webMaster] => [email protected] [copyright] => ©2012 Google [pubDate] => Sun, 22 Apr 2012 01:00:21 GMT [lastBuildDate] => Sun, 22 Apr 2012 01:00:21 GMT [image] => SimpleXMLElement Object ( [title] => realmadrid: Google Noticias [url] => https://ssl.gstatic.com/news/img/logo/es_mx/news.gif [link] => http://news.google.com.mx/news?gl=mx&pz=1&ned=es_mx&hl=es&q=realmadrid ) [item] => Array ( [0] => SimpleXMLElement Object ( [title] => El Real Madrid apuntilla al Barça en el Camp Nou (1-2) - Republica.com (blog) [link] => http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGDpztvnga7JP035sqyCqZUrp_Elw&url=http://www.republica.com/2012/04/20/barca-realmadrid-2_482059/ [guid] => tag:news.google.com,2005:cluster=http://www.republica.com/2012/04/20/barca-realmadrid-2_482059/ [pubDate] => Sat, 21 Apr 2012 21:19:44 GMT [description] => 
最佳回答

我在检查所有法典后进行。 如果有人帮助:

$data = file_get_contents( https://news.google.com.mx/news/feeds?hl=es&gl=mx&q=realmadrid&um=1&ie=UTF-8&output=rss );

$xml = new SimpleXMLElement($data);
$channel = array();
$channel[ title ]       = $xml->channel->title;

foreach ($xml->channel->item as $item)
{

    //echo $article[ title ] = $item->title;
    //echo $article[ link ] = $item->link;
    echo $article[ pubDate ] = $item->pubDate;
    echo $article[ description ] = (string) trim($item->description);

}
问题回答

你们必须把项目打下。

$data = file_get_contents( https://news.google.com.mx/news/feeds?hl=es&gl=mx&q=realmadrid&um=1&ie=UTF-8&output=rss );
 $xml_data = simplexml_load_string($data);
 $items = $xml_data->xpath( channel/item );
foreach ($items as $item) {
   echo "title" . $item->title;
}

它迅速 co,如果它会有任何问题,就只给我写信。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签