-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss_for_google.php
More file actions
executable file
·29 lines (29 loc) · 1.65 KB
/
rss_for_google.php
File metadata and controls
executable file
·29 lines (29 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include('./library/db.php');
include("./library/function.php");
$g_news = $conn->query("SELECT * FROM `google_news` Order by 'id'");
$sql = "SELECT * FROM `posts` Where types='1' ORDER BY `post_id` DESC";
$qry = $conn->query($sql);
header('Content-type: text/xml');
echo "<?xml version='1.0' encoding='UTF-8' ?>" . PHP_EOL;
echo '<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' . PHP_EOL;
echo '<channel>' . PHP_EOL;
echo '<title>Bongo Path</title>' . PHP_EOL;
echo '<link>' . $baseurl . '</link>' . PHP_EOL;
echo '<description>Latest news, analysis and opinion by the reporters of Bongo Path, Subscribe for Bangladesh and International news, business, politics, sports, science, technology, health, arts and more.</description>' . PHP_EOL;
while ($g_news_fetch_assoc = $g_news->fetch_assoc()) {
$Temp_g_news_fetch_assoc = $g_news_fetch_assoc['news_id'];
$g_news_post = $conn->query("SELECT * FROM `posts` WHERE post_id='$Temp_g_news_fetch_assoc' AND types='1' ORDER BY `time` DESC");
$row = $g_news_post->fetch_assoc();
// Now Access The Fetches
echo '<item>' . PHP_EOL;
echo '<title>' . $row['post_title'] . '</title>' . PHP_EOL;
echo '<content:encoded><![CDATA[' . $row['post_details'] . ']]></content:encoded>' . PHP_EOL;
echo '<link>' . $baseurl . "post/" . catStraper($conn,$row['post_cat']) . "/" . $row["postSlug"] . '</link>' . PHP_EOL;
echo '<guid>' . $row['post_id'] . '</guid>' . PHP_EOL;
echo '<pubDate>' . date('Y-m-d', strtotime($row['time'])) . '</pubDate>' . PHP_EOL;
echo '</item>' . PHP_EOL;
}
echo '</channel>' . PHP_EOL;
echo '</rss>' . PHP_EOL;
?>