PHP code example of baraja-core / wayback

1. Go to this page and download the library: Download baraja-core/wayback 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/ */

    

baraja-core / wayback example snippets


$wayback = new Wayback;

// Return list of available archives by host
$wayback->getArchivedUrlsByHost('baraja.cz');

// Return list of available archives by URL (http/https and www will be ignored)
$wayback->getArchivedUrls('https://php.baraja.cz/navody');

// Return list of crawled subdomains (for large sites can not be complete)
$wayback->getSubdomains('baraja.cz');

// Save now given URL to Wayback
$wayback->saveUrl('https://baraja.cz');

// Find nearest archived datetime
$wayback->getClosedArchivedDateTime('https://baraja.cz/robots.txt', new \DateTime('2020-09-04'));

// Find and download nearest archived file
$wayback->getClosedArchivedFile('https://baraja.cz/robots.txt', new \DateTime('2020-09-04'));

// Download specific file by wayback link
$wayback->getArchivedFile('http://web.archive.org/web/20200923184117/https://baraja.cz/robots.txt');