PHP code example of sunsetboy / sitechecker_sdk

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

    

sunsetboy / sitechecker_sdk example snippets


// init the SiteChecker
$siteChecker = new SiteChecker(
    'sitechecker_url',
    'your_api_key',
    10 // timeout in seconds, 10 by default
);

/* 
    Create a new job
*/
$websiteId = YOUR_WEBSITE_ID;
// urls to check, at least 1
$urls = [
    'http://www.example.com',
    'http://www.example.com/my-url',
];
$sitemapUrl = 'http://www.example.com/sitemap.xml'; // could be an empty string

$createdJobDto = $siteChecker->createJob($websiteId, $urls, $sitemapUrl);

/** @var \SiteCheckerSDK\Dto\Job $createdJobId */
$createdJobId = $createdJobDto->getId();

// now you can use this id to request your job results

/*
 * Get a job results
 */
/** @var \SiteCheckerSDK\Dto\Job $jobResult */ 
$jobResult = $siteChecker->getJob($createdJobId);