Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php VBulletin主网站RSS源_Php_Rss_Vbulletin - Fatal编程技术网

Php VBulletin主网站RSS源

Php VBulletin主网站RSS源,php,rss,vbulletin,Php,Rss,Vbulletin,我没有包括我的网站url,它是一个vbulletin论坛,所有rss/xml选项都已启用。(据我所知) channel->item as$item){ //根据标题和描述创建变量(也可用于图像和链接) $title=$item->title; $description=$item->description; $date=$item->pubDate; $user=$item->dc:creator; //在您的网站上显示标题和说明,格式可根据您的需要而定 回显“”.$title.-On“$dat

我没有包括我的网站url,它是一个vbulletin论坛,所有rss/xml选项都已启用。(据我所知)

channel->item as$item){
//根据标题和描述创建变量(也可用于图像和链接)
$title=$item->title;
$description=$item->description;
$date=$item->pubDate;
$user=$item->dc:creator;
//在您的网站上显示标题和说明,格式可根据您的需要而定
回显“”.$title.-On“$date.”由“$user.”
“.$description.”

”; }} ?>
这是我正在使用的代码。我之前没有日期,但我通过我论坛上的rss2订阅源了解到了这一点。然而,我不知道如何找到这篇文章的作者。当我查看rss2页面时,我能找到的对作者的唯一引用是dc:creator变量。我尝试将其添加到我的代码中。然而,我不断地得到一份工作

解析错误:语法错误,第16行的/public_html/bfdm/1/rss.php中出现意外的“:”

它显然不喜欢这样的环境

我尝试过使用DOM加载($xml=new-DOMDocument(); $xml->load($feed);)但两者都不起作用

基本上,我只想从我的Vbulletin帖子中提取主题、日期、用户和线程内容。这几天我都快疯了

现在我突然变得

警告:simplexml_load_file()要求参数1为字符串,即第6行/public_html/bfdm/1/rss.php中给定的资源

在上面带有

的代码上,这应该可以工作(或者至少当它有一个
-
时可以工作):

名称中的其他一些特殊字符也必须如此,如
-

编辑:在这种情况下不是。但是,最终工作代码应为:

<?php
// this is the url of the rss feed that you want to display
$feed = 'URL OF THE RSS'; //replace this with the RSS's URL
$xml = simplexml_load_file($feed);
//if the feed exists, then continue...
if ($xml!=''){
foreach ($xml->channel->item as $item){
// create variables from the title and description (can also be used for images and  links)
$title = $item->title;
$description = $item->description;
$date = $item->pubDate;
$user = $item->children('dc', true)->creator;
// displays the title and description on your website, formatted any way you want
echo '<p><b>'.$title.'</b> - On '.$date.' by '.$user.' <br />'.$description.'</p>';
}}
?> 

新的问题是这个警告:simplexml_load_file()期望参数1是字符串,第6行的/public_html/bfdm/1/rss.php中给出的资源不知道为什么它突然给出了这个值(在我尝试使用您的建议之前)使用
$feed=http://myvbforum.com/external.php?type=rss2&forumid=33';和它将工作。不需要curl。它给了我一些curl错误,但我猜这就是尝试从一个不存在的curl调用的问题。然而,海报的名字仍然没有出现。这是vbulletins RSS2的问题吗?可以用rss代替吗?删除所有的curl代码。关于海报的名字,我来看看。希望很快我就能说出原因。我真的很感激:)。我已经找了三天了。我在这里或那里发现了一些小鼻涕虫,但我似乎什么也做不到。它可能只是RSS2。
$user = $item->{'dc:creator'};
<?php
// this is the url of the rss feed that you want to display
$feed = 'URL OF THE RSS'; //replace this with the RSS's URL
$xml = simplexml_load_file($feed);
//if the feed exists, then continue...
if ($xml!=''){
foreach ($xml->channel->item as $item){
// create variables from the title and description (can also be used for images and  links)
$title = $item->title;
$description = $item->description;
$date = $item->pubDate;
$user = $item->children('dc', true)->creator;
// displays the title and description on your website, formatted any way you want
echo '<p><b>'.$title.'</b> - On '.$date.' by '.$user.' <br />'.$description.'</p>';
}}
?>