URL: https://samaraspectehnika.ru/sitemap.xml
✅ HTTP 200 OK
Размер ответа: 588 байт
Первые байты (hex): 3c3f
Ответ не в формате gzip
<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://samaraspectehnika.ru/sitemap_storage__firms__28__26__26781__sitemap1.xml.gz</loc>
<lastmod>2026-01-14T19:21:04+02:00</lastmod>
</sitemap>
<sitemap>
<loc>https://samaraspectehnika.ru/sitemap_storage__firms__28__26__26781__sitemap2.xml.gz</loc>
<lastmod>2026-01-14T19:21:04+02:00</lastmod>
</sitemap>
</sitemapindex><?php
class SimpleSitemapParser {
private $baseUrl = 'https://samaraspectehnika.ru';
public function getSitemapContent($url) {
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_USERAGENT => 'Mozilla/5.0',
CURLOPT_ENCODING => '' // важно для gzip
]);
$content = curl_exec($ch);
curl_close($ch);
// Распаковываем gzip если нужно
if (substr($content, 0, 2) == "\x1f\x8b" && function_exists('gzdecode')) {
$content = @gzdecode($content);
}
return $content;
}
public function getAllProductUrls($limit = 100) {
// 1. Получаем основной sitemap
$sitemap = $this->getSitemapContent($this->baseUrl . '/sitemap.xml');
// 2. Ищем файлы sitemap
preg_match_all('/https:\/\/samaraspectehnika\.ru\/sitemap_storage__[^"\s]+\.xml\.gz/i', $sitemap, $matches);
$allUrls = [];
foreach ($matches[0] as $sitemapFile) {
// 3. Получаем каждый файл
$fileContent = $this->getSitemapContent($sitemapFile);
// 4. Ищем товары
preg_match_all('/https:\/\/samaraspectehnika\.ru\/p\/[^"\s]+/i', $fileContent, $productMatches);
$allUrls = array_merge($allUrls, $productMatches[0]);
if (count($allUrls) >= $limit) break;
}
return array_slice(array_unique($allUrls), 0, $limit);
}
}
?>