Skip to content

How to calculate google backlinks using php

jarmoluk / Pixabay

There are several ways to implement a calculation of the number of backlinks via PHP.

$domain = ""; // Enter your domain here.

$url = ""
    . "q=link:".$domain;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $domain);
$body = curl_exec($ch);

$json = json_decode($body);
$urls = array();
foreach($json->responseData->results as $result) // Loop through the objects in the result
    $urls[] = $result->unescapedUrl;             // and add the URL to the array.

Basically you edit the domain variable at the top and it will fill the $urls array with unescaped URLs linking to the domain.


Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen