Skip to content

Instantly share code, notes, and snippets.

@gklka
Created February 22, 2013 07:37
Show Gist options
  • Save gklka/5011530 to your computer and use it in GitHub Desktop.
Save gklka/5011530 to your computer and use it in GitHub Desktop.
beszeljukmac.com RSS fix
<?php
if ($_GET['url']) {
$url = $_GET['url'];
} else {
$url = "http://beszeljukmac.com/index.php/rss/hirek";
}
$page = file_get_contents($url);
$page = iconv("ISO-8859-2", "UTF-8", $page);
$page = str_replace("iso-8859-2", "utf-8", $page);
if (!$_GET['url']) {
$page = str_replace("<link>http://beszeljukmac.com", "<link>http://gk.lka.hu/beszmacrss.php?url=http://beszeljukmac.com", $page);
$page = str_replace('<guid isPermaLink="true">http://beszeljukmac.com', '<guid isPermaLink="true">http://gk.lka.hu/beszmacrss.php?url=http://beszeljukmac.com', $page);
header("Content-Type:text/xml; charset=utf-8");
} else {
$tmp = split('<div class="article" style="border-bottom:none;">', $page);
$tmp = $tmp[1];
$tmp = split('<div class="articlecategory">', $tmp);
$tmp = $tmp[0];
$tmp = str_replace('class="commentsSocial"', 'class="commentsSocial" style="display:none;', $tmp);
$tmp = str_replace('class="articleauthor"', 'class="articleauthor" style="display:none;"', $tmp);
$tmp = str_replace('class="articlecomments"', 'class="articlecomments" style="display:none;"', $tmp);
$tmp = str_replace('class="facebookLike"', 'class="facebookLike" style="display:none;"', $tmp);
$tmp = str_replace('class="tweetLike"', 'class="tweetLike" style="display:none;"', $tmp);
$page = "<html><body>" . $tmp . "</div></body></html>";
header("Content-Type:text/html; charset=utf-8");
}
print $page;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment