· 4 years ago · Jan 23, 2021, 01:30 AM
1$objectURL = ""; /* YOUR DOMAIN WITH HTTP OR HTTPS */
2$accessID = ""; /* ACCESS ID */
3$secretKey = ""; /* SECRET KEY */
4$expires = time() + 300;
5$stringToSign = $accessID."\n".$expires;
6$binarySignature = hash_hmac('sha1', $stringToSign, $secretKey, true);
7$urlSafeSignature = urlencode(base64_encode($binarySignature));
8$cols = "103079215140";
9$requestUrl = "http://lsapi.seomoz.com/linkscape/url-metrics/".urlencode($objectURL)."?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature;
10$options = array(
11 CURLOPT_RETURNTRANSFER => true
12);
13$ch = curl_init($requestUrl);
14curl_setopt_array($ch, $options);
15$content = curl_exec($ch);
16curl_close($ch);
17$json_a = json_decode($content);
18$pageAuthority = round($json_a->upa,0);
19if($pageAuthority == 0){
20 $pageAuthority = 1;
21}
22$domainAuthority = round($json_a->pda,0);
23if($domainAuthority == 0){
24 $domainAuthority = 1;
25}
26echo $pageAuthority; /* PAGE AUTHORITY (PA) */
27echo "<br>";
28echo $domainAuthority; /* DOMAIN AUTHORITY (DA) */