<?php

namespace OtomaticAi\Vendors;

require_once \dirname(__FILE__) . "/../vendor/autoload.php";
use OtomaticAi\Vendors\vipnytt\SitemapParser;
use OtomaticAi\Vendors\vipnytt\SitemapParser\Exceptions\SitemapParserException;
/**
 * Basic recursive example
 * Fast and easy to use
 * Optimized for smaller pages
 */
try {
    $parser = new SitemapParser('MyCustomUserAgent');
    $parser->parseRecursive('http://www.google.com/robots.txt');
    echo '<h2>Sitemaps</h2>';
    foreach ($parser->getSitemaps() as $url => $tags) {
        echo 'URL: ' . $url . '<br>';
        echo 'LastMod: ' . $tags['lastmod'] . '<br>';
        echo '<hr>';
    }
    echo '<h2>URLs</h2>';
    foreach ($parser->getURLs() as $url => $tags) {
        echo 'URL: ' . $url . '<br>';
        echo 'LastMod: ' . $tags['lastmod'] . '<br>';
        echo 'ChangeFreq: ' . $tags['changefreq'] . '<br>';
        echo 'Priority: ' . $tags['priority'] . '<br>';
        echo '<hr>';
    }
} catch (SitemapParserException $e) {
    echo $e->getMessage();
}
