· 7 years ago · Nov 06, 2018, 10:42 AM
1<title>MozRank Checker</title>
2<link href="https://fonts.googleapis.com/css?family=Share+Tech+Mono" rel="stylesheet">
3<style>
4body {
5background:black;
6color:green;
7font-family: Share Tech Mono ;
8}
9textarea {
10background:black;
11color:green;
12margin:4px;
13padding:5px;
14border:1px solid green;
15font-family: Share Tech Mono ;
16}
17input[type=submit] {
18background:green;
19color:black;
20border:1px solid green;
21font-family: Share Tech Mono ;
22}
23</style>
24<center>
25<center>DA = Domain Authority, PA = Page Authority, MR = MozRank, EL = External Links to URL
26<br><br>
27<form method="post">
28<textarea name="url_form" cols="40" rows="8" style="width: 400px">
29<?=$_REQUEST['url_form'];?>
30</textarea >
31<br />
32<input type="submit" style="margin-top: 5px; font-size: 18px" value="Check Metrics" />
33</form>
34</center>
35<?php
36if($_REQUEST['url_form']) {
37$urls = trim($_POST['url_form']);
38$urls = explode("\n", $urls);
39$urls = array_filter($urls, 'trim');
40}
41if(!$urls) {
42exit;
43}
44?>
45<div style="margin: auto; width: 50%; min-width: 400px">
46<table width="500" cellpadding="5" cellspacing="5">
47<thead style="text-align: left">
48<tr><th>ID</th><th>URL</th><th>DA</th><th>PA</th><th>MR</th><th>EL</th></tr></thead>
49<tbody>
50<?php
51$hitung = 0;
52$urlx = array();
53$verif_url = array_chunk($urls,80);
54foreach($verif_url as $chunk) {
55sleep(2);
56unset($url);
57$url = $chunk;
58$seo = API_MOZ($url);
59if($seo['error'] != '') {
60echo "Error[SEOMoz]: ".$seo['error']."<br>";
61} else {
62foreach($seo as $index => $data) {
63$urls['pa'] = number_format($data['pa'], 0, '.', '');
64$urls['url'] = $data['url'];
65$urls['da'] = number_format($data['da'], 0, '.', '');
66$urls['title'] = $data['title'];
67$urls['external_links'] = $data['external_links'];
68$urls['mozrank'] = number_format($data['mozrank'], 2, '.', '');
69$hitung++;
70echo "<tr><td>";
71echo $hitung;
72echo "</td><td>";
73echo str_replace("http://","",$urls['url']);
74echo "</td><td>";
75echo $urls['da'];
76echo "</td><td>";
77echo $urls['pa'];
78echo "</td><td>";
79echo $urls['mozrank'];
80echo "</td><td>";
81echo $urls['external_links'];
82echo "</td>";
83echo "</tr>";
84$urlx[] = $urls;
85}
86}
87}
88?>
89</tbody></table>
90<br><br>
91© Design By HTML404 2018
92<?php
93$_SESSION['urlx'] = $urlx;
94if(!empty($urlx)) { }
95?>
96</center>
97</div>
98<?php
99// Document code by Moz
100// www.stateofdigital.com
101function API_MOZ($objectURL) {
102// cek https://moz.com/products/api/keys untuk mendapatkan accessID dan secretKey nya
103// your accessID
104$accessID = "mozscape-4f3765f6c2";
105// your secretKey
106$secretKey = "72c60c0d7f5bc0fad86ab432eaaf32ce";
107$expires = time() + 600;
108$stringToSign = $accessID."\n".$expires;
109$binarySignature = hash_hmac('sha1', $stringToSign, $secretKey, true);
110$urlSafeSignature = urlencode(base64_encode($binarySignature));
111$cols = 68719476736+34359738368+536870912+32768+16384+2048+32+4;
112$requestUrl = "http://lsapi.seomoz.com/linkscape/url-metrics/?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature;
113$batchedDomains = $objectURL;
114$encodedDomains = json_encode($batchedDomains);
115$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS =>$encodedDomains);
116$ch = curl_init($requestUrl);
117curl_setopt_array($ch, $options);
118$content = curl_exec($ch);
119curl_close( $ch );
120$response = json_decode($content,true);
121$count = 0;
122if(isset($response['error_message'])) {
123$list = array('error'=>$response['error_message']);
124} else {
125foreach($response as $metric) {
126$list[$count]['url'] = $objectURL[$count];
127$list[$count]['subdomain'] = $metric['ufq'];
128$list[$count]['domain'] = $metric['upl'];
129$list[$count]['pa'] = $metric['upa'];
130$list[$count]['da'] = $metric['pda'];
131$list[$count]['mozrank'] = $metric['umrp'];
132$list[$count]['title'] = $metric['ut'];
133$list[$count]['external_links'] = $metric['ueid'];
134$count++;
135}
136}
137return $list;
138}
139?>