Skip to content

Instantly share code, notes, and snippets.

@gklka
Last active March 7, 2022 16:29
Show Gist options
  • Save gklka/65243274c9d06c50f34ed504249c72ee to your computer and use it in GitHub Desktop.
Save gklka/65243274c9d06c50f34ed504249c72ee to your computer and use it in GitHub Desktop.
<?php
$url = "http://index.hu/tech/rss/default/";
if (array_key_exists("url", $_GET)) {
if (strpos($_GET["url"], "http://") === 0) {
$url = $_GET["url"];
}
}
$file = file_get_contents($url);
header("Content-Type: application/rss+xml");
$separator = "\r\n";
$line = strtok($file, $separator);
$gather_item = false;
$item = "";
$creator = "";
while ($line !== false) {
if (strpos($line,"<item>") !== false) {
$gather_item = true;
}
if (strpos($line,"</item>") !== false) {
$gather_item = false;
if (strpos($creator, "Tóth Balázs") == false &&
strpos($creator, "lica") == false) {
print $item . $line . "\n";
}
$item = "";
$creator = "";
} else {
if ($gather_item) {
$item = $item . $line . "\n";
if (strpos($line, "<dc:creator>") !== false) {
$parts = explode("<dc:creator>", $line);
$parts = explode("</dc:creator>", $parts[1]);
$creator = $parts[0];
}
} else {
print $line . "\n";
}
}
$line = strtok($separator);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment