i want to create my own tool for back-links calculation using PHP. is there any api to fetech the data for back links
The full implementation in PHP would look something like this:
<?php
$domain = "example.com"; // Enter your domain here.
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=large&"
. "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.
EDIT: I've edited the link to return 8 results. For more, you'll have to parse the pages and loop through them with the start parameter. See the Class Reference for more information.
Run a Google search with the URL prefixed by link:
- for instance, link:www.mydomain.com
.
While Google does provide a more specific backlink overview in their Webmaster Tools area (more info), I'm not sure they provide an external API for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With