Este sitio web utiliza cookies para realizar análisis y mediciones de tus visitas. [ Acepto ] [ Más información aquí ].

How to Use Mozscape API

Learn how to use Mozscape API (old Open Site Explorer) to get metrics from SeoMoz such as Domain Authority, Page Authority, and many others. Follow these steps:

1. Log into SeoMoz and get you API credentials here: http://www.seomoz.org/api/keys

2. Use this PHP code, while replacing the bold letters: 1) access ID, 2) secret key, 3) web page, 4) bit flags sum. You should perform the bit flags sum by adding up the corresponding number of each metric you want to obtain: http://apiwiki.seomoz.org/categories/api-reference. In this example, we'll take Domain Authority and Page Authority, whose bit flags add up to 103079215104.

$accessID = "member-fe164b1e59";

$secretKey = "23c01f24d0fc1d782ab2c523aa188c1d";

$expires = time() + 300;

$stringToSign = $accessID."\n".$expires;

$binarySignature = hash_hmac('sha1', $stringToSign, $secretKey, true);

$urlSafeSignature = urlencode(base64_encode($binarySignature));

$objectURL = "www.seomoz.org";

$cols = "103079215104";

$requestUrl = "http://lsapi.seomoz.com/linkscape/url-metrics/".urlencode($objectURL).

"?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature;

$options = array(

CURLOPT_RETURNTRANSFER => true

);

$ch = curl_init($requestUrl);

curl_setopt_array($ch, $options);

$content = curl_exec($ch);

curl_close($ch);

$contents = json_decode($content);

echo "Domain Authority: " . $contents->pda . "<br/>";

echo "Page Authority: " . $contents->upa . "<br/>";

Añadir comentario