我在连接到 MySQL 的 php 中创建了一个 RSS 提要 php 文件。根据 ID,如果您单击 RSS 链接,它将为每个人生成一个 RSS 提要。但我想知道如何将我的 RSS 提要 php 文件链接到 RSS 链接。这是我的PHP文件代码:
<html>
<head>
<title>New Feed</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
</head>
<body>
<?php
Function NewFeed($DingoID,$TITLE,$NOTE,$DATE,$LINK){
$SQLString="SELECT Dingoid FROM rahul_tbl_users";
switch ($DingoID){
case "AllUsers":
break;
case "AdminUsers":
$SQLString.=" WHERE Usertype='Admin'";
break;
default:
$SQLString.=" WHERE Dingoid='".$DingoID."'";
break;
}
$Ergebnis=mysql_query ($SQLString);
$Datensatz=mysql_fetch_array($Ergebnis);
if ($Datensatz){
while ($Datensatz){
$DingoID=$Datensatz["Dingoid"];
$SQLString="INSERT INTO TblNotifications (DingoID,Title,Note,Date,Link) VALUES('".$DingoID."','".$TITLE."','".$NOTE."','".$DATE."','".$LINK."')";
$Ergebnis3=mysql_query ($SQLString) or die("IDD-Feeds: Feed nicht eingetragen");
//echo $SQLString;
//echo $Ergebnis3;
//echo ("Hier sind wir in der Function 'NewFeed'");
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->formatOutput = true;
//echo "Vor Create Element";
$roo = $xml->createElement('rss');
// "Nach Create Element";
$roo->setAttribute('version', '2.0');
$xml->appendChild($roo);
$cha = $xml->createElement('channel');
$roo->appendChild($cha);
$hea = $xml->createElement('title',
utf8_encode('IDD-RSS'));
$cha->appendChild($hea);
$hea = $xml->createElement('description',
utf8_encode('IDD Request Feeds'));
$cha->appendChild($hea);
$hea = $xml->createElement('language',
utf8_encode('en'));
$cha->appendChild($hea);
$hea = $xml->createElement('link',
htmlentities('http://intranet.siemens-enterprise.com/sitecore/content/Home/Intranet/organization/sales/global-sales-operations/global-bid-management/international-cross-border-group/international-deal-desk'));
$cha->appendChild($hea);
$hea = $xml->createElement('lastBuildDate',
utf8_encode(date("D, j M Y H:i:s ").'CET'));
$cha->appendChild($hea);
$SQLString2="SELECT * FROM TblNotifications WHERE DingoID='".$DingoID."' ORDER BY Date";
//echo $SQLString;
$Ergebnis2=mysql_query ($SQLString2) or die("IDD-Feeds: Keine Daten aus dem Notification-File");
$Datensatz2=mysql_fetch_array($Ergebnis2);
if ($Datensatz2){
while ($Datensatz2){
$itm = $xml->createElement('item');
$cha->appendChild($itm);
$dat = $xml->createElement('title',utf8_encode($Datensatz2["Title"]));
$itm->appendChild($dat);
$dat = $xml->createElement('description',utf8_encode($Datensatz2["Note"]));
$itm->appendChild($dat);
$dat = $xml->createElement('link',htmlentities($Datensatz2["Link"]));
$itm->appendChild($dat);
$dat = $xml->createElement('pubDate',utf8_encode($Datensatz2["Date"]));
$itm->appendChild($dat);
$dat = $xml->createElement('guid',utf8_encode($Datensatz2["FeedID"]));
$itm->appendChild($dat);
$Datensatz2=mysql_fetch_array($Ergebnis2);
}
}
//echo "Jetzt wird dann das xml-File geschrieben mit: ".$DingoID;
$xml->save('../feeds/'.$DingoID.'.rss');
$Datensatz=mysql_fetch_array($Ergebnis);
}
}
}
?>
</body>
</html>
我想将此 php 代码链接到 RSS 链接,以便 RSS 提要工作。这是我的 RSS 提要链接:
<?php
if(!isset($_SESSION))
{
session_start();
$dingo=$_SESSION['dingo'];
}
?>
<ul>
All feeds are populated even if the Email has been deactivated.Your feeds are:
<li>
<label for="g_feed_browser"><a style="color:black; text-decoration:none" href="http://rss.groups.yahoo.com/group/rss-board/<?php echo $dingo; ?>"
target="_blank"><img src="rss1.gif" width="17" height="17" border="0" >Subscribe to your personal/group HTTP feed via browser: </a></label>
</li> <br>
<li>
<label for="g_feed_outlook"><a style="color:black; text-decoration:none" href="feed://rss.groups.yahoo.com/group/rss-board/rss"
target="_blank"><img src="rss1.gif" width="17" height="17" border="0" >Subscribe to your personal/group feed using Outlook : </a></label>
</li><br>
IDD General rss feeds are as follows:<br>
<li>
<label for="idd_feed_browser"><a style="color:black; text-decoration:none" href="http://feeds.rssboard.org/rssboard"
target="_blank"><img src="rss1.gif" width="17" height="17" border="0" >Subscribe IDD HTTP feed via browser: </a></label>
</li><br>
<li>
<label for="idd_feed_outlook"><a style="color:black; text-decoration:none" href="http://feeds.rssboard.org/rssboard"
target="_blank"><img src="rss1.gif" width="17" height="17" border="0" >Subscribe to IDD feed using Outlook: </a></label>
</li>
</ul>