PHP code example of rvalitov / backlink-checker-php

1. Go to this page and download the library: Download rvalitov/backlink-checker-php 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/ */

    

rvalitov / backlink-checker-php example snippets





Valitov\BacklinkChecker;

$checker = new BacklinkChecker\ChromeBacklinkChecker();

$checker = new BacklinkChecker\SimpleBacklinkChecker();

$url = "https://example.com";
$pattern = "@https?://(www\.)?mywebsite\.com.*@";
$scanBacklinks = true;
$scanHotlinks = false;
$makeScreenshot = true;

try {
    $result = $checker->getBacklinks($url, $pattern, $scanBacklinks, $scanHotlinks, $makeScreenshot);
} catch (RuntimeException $e) {
    die("Error: " . $e->getMessage());
}

$response = $result->getResponse();
if ($response->getSuccess()) {
    $links = $result->getBacklinks();
    if (sizeof($links) > 0)
        //Backlinks found
    else {
        //No backlinks found
    }
} else {
    //Error, usually network error, or server error
    die("Error, HTTP Code " . $response->getStatusCode());
}

$base64_image = "data:image/jpeg;base64," . base64_encode($response->getScreenshot());
bash
php composer 
bash
php composer update