skip to Main Content

How to calculate google backlinks using php

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

<?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);curl_close($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.


Back To Top