Home PHP JavaScript CSS WordPress APIs .htaccess Other How-To Useful Scripts What I Recommend
Posted on by Aleksandar Gichevski ()
MOZ or formerly SEOmoz is the best search engine optimization suite that provides lot of SEO tools that help you in research on global most important SEO aspects. What I like the most from this service is the ease and full reporting on information that you can't find anywhere else. Using Moz API we can extract lot of important data by accessing some of the endpoints that MOZ offers.

An endpoint is a resource available in Mozscape and current available are:
  • URL metrics
  • Link metrics
  • Anchor text metrics
  • Top pages
  • Metadata
In this post I'm going to write about accessing URL metrics and getting data regarding some URL like MOZRank, Domain Authority, MOZ External Links, MOZ Total Links and other info that these days is very valuated by SEO industry. We are going to use the MOZ Free API Access without paying. In Free API Access there are 2 types of limitations:
  • First, is the parameters that you can get - Check this link for more info and see what data is availabe with Free Access http://apiwiki.moz.com/url-metrics
  • Second, there is rate limit of one request every 10 seconds - but this is not always true because I got results within 2,3 seconds in 50% of the requests

Create MOZ Free Account

To be able to use Free MOZ API first thing that you must do is create free account. To do so visit this link: https://moz.com/community/join

Fill the form there and make sure you use real email because you will need to validate your account and that's it.

Generate your Access ID and API key

Second step is to generate Access ID and API key that we are going to use in our example to get data. So after signup login to MOZ and visit: http://moz.com/products/api/keys Click "Generate Secret Key" in the box below and your data will be generated. After completion of the process you should see screen like this:

Getting MOZ Data

After getting your Access ID and API Secret key you can now code the PHP script for getting MOZ Data. In below example I show you how you make a call to MOZ API and get MOZRank, Domain Authority, External and Total Links for specific domain.

$ch = curl_init($curlURL);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close( $ch );

$response = json_decode($response);
Replace Your Access ID, Secret Key, add the Domain in the script and you will get array of results for:
  • Moz Rank - 16384 (umrp, umrr), The MozRank of the URL, in both the normalized 10-point score (umrp) and the raw score (umrr)
  • Domain Authority - 68719476736 (pda), A normalized 100-point score representing the likelihood of a domain to rank well in search engine results
  • External Links - 32 (ueid), The number of external equity links to the URL
  • Links - 2048 (uid), The number of links (equity or nonequity or not, internal or external) to the URL
The response that you will get should look like this:

    [0] => stdClass Object
            [pda] => 19.8114141723
            [ueid] => 1
            [uid] => 1
            [umrp] => 2.69267070574
            [umrr] => 5.93757244179E-13


From the numbers I wrote above you probably see how the $data parameter is created.. We just calculate all numbers 16384 + 68719476736 + 32 + 2048 = 68719495200 Using this script you can get all data that are allowed in Free MOZ API, while if you want some other data that is not Free then you must choose one of the MOZ Pro API packages.

Other Posts You Might Like

Get a fast, free website audit

Enter your URL below to get full in-depth SEO report and tips.


Useful Scripts

Most Popular Posts

Recent Posts

June 14th, 2014
Website Optimization Using Gzip Compression

June 10th, 2014
Google Search AutoComplete API

May 14th, 2014
What is a Tag Cloud and How to Calculate it by Formula

March 27th, 2014
Error writing file /tmp (errcode 28) Solved!

February 15th, 2014
Fixed CSS & HTML Navigation Bar

February 9th, 2014
Benchmark Your Server (CPU, File IO, MySQL) with SysBench

February 8th, 2014
JavaScript Array Basics

January 29th, 2014

January 25th, 2014
Payoneer Debit Card for Freelancers to receive money online

January 24th, 2014
How HTML Color Codes are generated?

Read Latest Posts directly on Facebook