Skip to content

Instantly share code, notes, and snippets.

@ertugrulturan
Last active January 31, 2021 04:25
Show Gist options
  • Save ertugrulturan/a1486ae14ce89e3662dcf261f913bfdb to your computer and use it in GitHub Desktop.
Save ertugrulturan/a1486ae14ce89e3662dcf261f913bfdb to your computer and use it in GitHub Desktop.
RSS - PHP Source
<?php
include 'config.php';
function lambda($a){
$a = str_replace("&", "&amp;", $a);
return $a;
}
header("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>RSS Source - T13R</title>
<description></description>
<link>https://obir.ninja/</link>
<language>tr-TR</language>
';
$veri = $db->prepare("SELECT * FROM icerikler ORDER BY icerik_id DESC");
$veri->execute();
$islem = $veri->fetchALL(PDO::FETCH_ASSOC);
foreach ($islem as $row) {
echo '
<item>
<title>'.lambda($row["makale_baslik"]).'</title>
<description>
<![CDATA[<img src="'.$row["makale_resim"].'"><br>
'.lambda($row["makale_aciklama"]).'
]]>
</description>
<link>'.$row["makale_link"].'</link>
<image>'.$row["makale_resim"].'</image>
<pubDate>'.$row["makale_tarih"].'</pubDate>
</item>
';
}
echo '</channel>
</rss> ';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment