PHP code example of migliori / sitemap-crawler
1. Go to this page and download the library: Download migliori/sitemap-crawler 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/ */
migliori / sitemap-crawler example snippets
itemapCrawler\Crawler;
use SitemapCrawler\SitemapService;
use SitemapCrawler\LinkCollection;
$config = 'filename.xml' to save file on server
*/
$dest = __DIR__ . '/sitemap.xml';
/**
* sitemap url for search engines submission
*/
$sitemap_url = 'http://www.google.com/sitemap.xml';
$crawler = new Crawler($config['crawler']);
$collection = new LinkCollection();
$provider = new SitemapService($crawler, $collection, $url, $config['sitemap_service']);
$links = $provider->crawl($url);
$provider->export('daily', $dest);
if ($config['submit_to_search_engines'] === true) {
$provider->SubmitSiteMap($sitemap_url);
}