Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //sites.txt - файл со списком доменов
- //в результате в файле res.csv будет информация по:
- //Сайт, год первого скриншота в вебархиве, статус http, год последнего скриншота в вебархиве, статус страницы http код ответа
- $sites = file('sites.txt');
- $lines = count ($sites);
- $l = $lines;
- foreach ($sites as $site)
- {
- echo "сайтов: " . $lines . " осталось: " . --$l . "\r\n";
- $site = rtrim($site);
- $query = 'http://web.archive.org/cdx/search/cdx?url='.$site.'&output=json';
- $webarchive = @file_get_contents($query);
- $webarchive = json_decode($webarchive);
- $c = count ($webarchive);
- if ($c == 0) {
- continue;
- }
- if ($c == 2) {
- file_put_contents('res.csv', $webarchive[1][2] . ' ; ' . substr($webarchive[1][1],0,4) . ';' . $webarchive[1][4] . "/r/n",FILE_APPEND);
- }
- else {
- file_put_contents('res.csv', $webarchive[1][2] . ' ; ' . substr($webarchive[1][1],0,4) . ';' . $webarchive[1][4] . ' ; ' .$webarchive[$c-1][2] . ' ; ' . substr($webarchive[$c-1][1],0,4) . ';' . $webarchive[$c-1][4] . "\r\n",FILE_APPEND);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment