/**
  * Gets Backlinkdetails from SEOmoz.
  * Limited to 25 links per source domain, due to using a free API key.
  *
  * @access		private
  * @link 		http://www.seomoz.org/api		The SEOmoz API
  * @return		array 					Returns array, containing linkdetails.
  */
 public static function Seomoz_Links($uri)
 {
     // external helper classes
     include_once 'ext/SeoMoz/Authenticator.php';
     include_once 'ext/SeoMoz/LinksService.php';
     include_once 'ext/SeoMoz/LinksConstants.php';
     $authenticator = new Authenticator();
     $linksService = new LinksService($authenticator);
     $result = $linksService->getLinks($uri, LINKS_SCOPE_PAGE_TO_DOMAIN, null, LINKS_SORT_PAGE_AUTHORITY, LINKS_COL_URL, 0, 25);
     return !empty($result) ? $result : 'No data available.';
 }
<?php

include '../bootstrap.php';
// Add your accessID here
$AccessID = '';
// Add your secretKey here
$SecretKey = '';
// Set the rate limit
$rateLimit = 10;
$authenticator = new Authenticator();
$authenticator->setAccessID($AccessID);
$authenticator->setSecretKey($SecretKey);
$authenticator->setRateLimit($rateLimit);
// URL to query
$objectURL = "www.seomoz.org";
// Metrics to retrieve (links_constants.php)
$options = array('scope' => LINKS_SCOPE_PAGE_TO_PAGE, 'filters' => LINKS_FILTER_EXTERNAL, 'sort' => LINKS_SORT_PAGE_AUTHORITY, 'source_cols' => URLMETRICS_COL_SUBDOMAIN, 'target_cols' => URLMETRICS_COL_SUBDOMAIN, 'link_cols' => LINKS_COL_URL, 'limit' => 10);
$linksService = new LinksService($authenticator);
$response = $linksService->getLinks($objectURL, $options);
echo "\n\n";
print_r($response);
Example #3
0
<?php

$objectURL = "www.seomoz.org";
//Add your accessID here
$AccessID = '';
//Add your secretKey here
$SecretKey = '';
include '../bootstrap.php';
$authenticator = new Authenticator();
$authenticator->setAccessID($AccessID);
$authenticator->setSecretKey($SecretKey);
/*$urlMetricsService = new URLMetricsService();
	$response = $urlMetricsService->getUrlMetrics($objectURL);
	var_dump($response);*/
$linksService = new LinksService($authenticator);
$response = $linksService->getLinks($objectURL, LINKS_SCOPE_PAGE_TO_PAGE, null, LINKS_SORT_PAGE_AUTHORITY, LINKS_COL_URL, 0, 10);
var_dump($response);
/*
$anchorTextService = new AnchorTextService($authenticator);
$response = $anchorTextService->getAnchorText($objectURL, ANCHOR_SCOPE_TERM_TO_PAGE, ANCHOR_SORT_DOMAINS_LINKING_PAGE, ANCHOR_COL_TERM_OR_PHRASE + ANCHOR_COL_INTERNAL_PAGES_LINK);
var_dump($response);
*/
/*
$topPagesService = new TopPagesService();
$response = $topPagesService->getTopPages($objectURL, TOPPAGES_COL_ALL, 0, 3);
var_dump($response);
*/