1. Go to this page and download the library: Download adabra/googlesitemapparser library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adabra / googlesitemapparser example snippets
\tzfrs\GoogleSitemapParser;
use \tzfrs\Exceptions\GoogleSitemapParserException;
try {
$posts = (new GoogleSitemapParser('http://tzfrs.de/sitemap.xml'))->parse();
foreach ($posts as $post) {
print $post . '<br>';
}
} catch (GoogleSitemapParserException $e) {
print $e->getMessage();
}
\tzfrs\GoogleSitemapParser;
use \tzfrs\Exceptions\GoogleSitemapParserException;
try {
$posts = (new GoogleSitemapParser('http://www.sainsburys.co.uk/robots.txt'))->parseFromRobots();
foreach ($posts as $post) {
print $post . '<br>';
}
} catch (GoogleSitemapParserException $e) {
print $e->getMessage();
}