<?php

// URL of the RSS feed
$url = 'https://backend.deviantart.com/rss.xml?type=deviation&q=by%3Aaoimatsuri+sort%3Atime+meta%3Aall';

// Load the RSS feed
$xml = simplexml_load_file($url);

// Check if the XML was loaded successfully
if ($xml === false) {
    echo "Failed to load XML.";
    exit;
}

// Loop through each item in the feed
foreach ($xml->channel->item as $item) {
    $link = (string)$item->link;
    // Encode the URL for use as a GET parameter
    $encodedLink = urlencode($link);

    // Build the target URL
    $targetUrl = "singlefetch.php?url=$encodedLink";

    // Fetch the result from the target URL
    $result = file_get_contents($targetUrl);

    // Print the result
    echo $result . "<br>";
}
?>
