1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[GET] Bulk DA Checker Using Free Moz API in PHP

Discussion in 'Black Hat SEO Tools' started by ebiz101, Feb 25, 2017.

  1. ebiz101

    ebiz101 Jr. VIP Jr. VIP

    Joined:
    Feb 16, 2010
    Messages:
    580
    Likes Received:
    135
    Register Moz, and get your Free API here :

    https://moz.com/products/api/keys

    Make sure to insert it into the code both accessID & secretKey


    Code:
    <?php
    // Get your access id and secret key here: https://moz.com/products/api/keys
    ob_start();
    error_reporting(E_ALL ^ E_NOTICE);
    set_time_limit(0);
    
    if (!$_POST['linkcheck']) {
    
       echo "<h2>Bulk Domain Authority</h2><form method='POST'><textarea name='linkcheck' cols=100 rows=30></textarea><br><input type=submit></form>";
       exit;
    
    }
    
    $domains = explode("\n",trim($_POST['linkcheck']));
    
    echo "<br><a href='http://moz.com' rel='nofollow'><img src='http://d2eeipcrcdle6.cloudfront.net/brand-guide/logos/moz_blue.png'></a><br>";
    ob_flush(); flush();
    
    $totdomain = count($domains);
    for ($i=0;$i<$totdomain;$i=$i+10){
      $batchedDomains = array();
     
      for ($j=0;$j<10;$j++){
        $cur = $i + $j;
        $domain =  trim($domains[$cur]);
        array_push($batchedDomains,$domain);
      }
      get_da($batchedDomains,$i,$filenameda);    ob_flush(); flush();
      sleep(20);
      //exit;
    }
    
    
    function get_da($batchedDomains,$i,$filenameda){
    
       $accessID = 'mozscape-xxxxxxxxx';
        $secretKey = 'xxxxxxxxxxxxxxxxxx';
       
    
        $expires = time() + 300;
        //echo "<br>$expires<br>";
    
        // Put each parameter on a new line.
        $stringToSign = $accessID."\n".$expires;
    
        // Get the "raw" or binary output of the hmac hash.
        $binarySignature = hash_hmac('sha1', $stringToSign, $secretKey, true);
    
        // Base64-encode it and then url-encode that.
        $urlSafeSignature = urlencode(base64_encode($binarySignature));
    
        // Add up all the bit flags you want returned.
        // Learn more here: https://moz.com/help/guides/moz-api/mozscape/api-reference/url-metrics
        $cols = "103616137252";
    
        // Put it all together and you get your request URL.
        $requestUrl = "http://lsapi.seomoz.com/linkscape/url-metrics/?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature;
    
        // Put your URLS into an array and json_encode them.
        $encodedDomains = json_encode($batchedDomains);
    
        // Use Curl to send off your request.
        // Send your encoded list of domains through Curl's POSTFIELDS.
        $options = array(
           CURLOPT_RETURNTRANSFER => true,
           CURLOPT_POSTFIELDS     => $encodedDomains
           );
    
        $ch = curl_init($requestUrl);
        curl_setopt_array($ch, $options);
        $content = curl_exec($ch);
        curl_close( $ch );
    
        $contents = json_decode($content);
       $counter =0;
        foreach ($contents as $obj){
            $domain = $obj->uu;
            $da = $obj->pda;    $da = round($da,2);
            if ($domain == "") $domain = trim($batchedDomains[$counter]);
           if ($domain == "") exit;
            echo "$domain|$da<br>";
           ob_flush(); flush();
            $counter++;
        }
    
    }
    
    ?>
    
     
    • Thanks Thanks x 2
  2. littlewebdragon

    littlewebdragon Jr. VIP Jr. VIP

    Joined:
    Dec 30, 2007
    Messages:
    1,708
    Likes Received:
    1,041
    Occupation:
    Occupation
    Location:
    Location
    Nice, just a hint. CURL multisessions and proxies :)
     
  3. ebiz101

    ebiz101 Jr. VIP Jr. VIP

    Joined:
    Feb 16, 2010
    Messages:
    580
    Likes Received:
    135
    Thanks.. never tried that.. so far I'm good without proxies just relying on their API
     
  4. littlewebdragon

    littlewebdragon Jr. VIP Jr. VIP

    Joined:
    Dec 30, 2007
    Messages:
    1,708
    Likes Received:
    1,041
    Occupation:
    Occupation
    Location:
    Location
    You are welcome. Just saying once when you want to check like 500k domains daily where to look at. :)
     
  5. ebiz101

    ebiz101 Jr. VIP Jr. VIP

    Joined:
    Feb 16, 2010
    Messages:
    580
    Likes Received:
    135
    Lol.. never tried that much.. just using for like couple hundreds per run.. also the free API limiation that you need to have 10 sec delay between each request.. unless you create 10 Free API account and rotate them :) , you can go on without delays
     
  6. spectrejoe

    spectrejoe Jr. VIP Jr. VIP

    Joined:
    Sep 25, 2013
    Messages:
    2,105
    Likes Received:
    440
    Home Page:
    I wonder whats the limit of the free api?
     
  7. littlewebdragon

    littlewebdragon Jr. VIP Jr. VIP

    Joined:
    Dec 30, 2007
    Messages:
    1,708
    Likes Received:
    1,041
    Occupation:
    Occupation
    Location:
    Location
    Exactly. :) And there is also 25k monthly limit per free account.
     
    • Thanks Thanks x 1
  8. nomania

    nomania Registered Member

    Joined:
    Mar 14, 2013
    Messages:
    67
    Likes Received:
    6
    Thanks....
     
  9. darinho

    darinho Newbie

    Joined:
    Oct 23, 2010
    Messages:
    36
    Likes Received:
    3
    It would be a good option to check (pa) also
     
  10. ebiz101

    ebiz101 Jr. VIP Jr. VIP

    Joined:
    Feb 16, 2010
    Messages:
    580
    Likes Received:
    135
    Thanks good idea.. below is the updated version

    PHP:
    <?php
    // Get your access id and secret key here: https://moz.com/products/api/keys
    ob_start();
    error_reporting(E_ALL E_NOTICE);
    set_time_limit(0);

    if (!
    $_POST['linkcheck']) {

       echo 
    "<h2>Bulk Domain Authority</h2><form method='POST'><textarea name='linkcheck' cols=100 rows=30></textarea><br><input type=submit></form>";
       exit;

    }

    $domains explode("\n",trim($_POST['linkcheck']));

    echo 
    "<br><a href='http://moz.com' rel='nofollow'><img src='http://d2eeipcrcdle6.cloudfront.net/brand-guide/logos/moz_blue.png'></a><br>";
    ob_flush(); flush();

    $totdomain count($domains);
    for (
    $i=0;$i<$totdomain;$i=$i+10){
      
    $batchedDomains = array();
     
      for (
    $j=0;$j<10;$j++){
        
    $cur $i $j;
        
    $domain =  trim($domains[$cur]);
        
    array_push($batchedDomains,$domain);
      }
      
    get_da($batchedDomains,$i,$filenameda);    ob_flush(); flush();
      
    sleep(20);
      
    //exit;
    }


    function 
    get_da($batchedDomains,$i,$filenameda){

       
    $accessID 'mozscape-xxxxxxxxx';
        
    $secretKey 'xxxxxxxxxxxxxxxxxx';
      

        
    $expires time() + 300;
        
    //echo "<br>$expires<br>";

        // Put each parameter on a new line.
        
    $stringToSign $accessID."\n".$expires;

        
    // Get the "raw" or binary output of the hmac hash.
        
    $binarySignature hash_hmac('sha1'$stringToSign$secretKeytrue);

        
    // Base64-encode it and then url-encode that.
        
    $urlSafeSignature urlencode(base64_encode($binarySignature));

        
    // Add up all the bit flags you want returned.
        // Learn more here: https://moz.com/help/guides/moz-api/mozscape/api-reference/url-metrics
        
    $cols "103616137252";

        
    // Put it all together and you get your request URL.
        
    $requestUrl "http://lsapi.seomoz.com/linkscape/url-metrics/?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature;

        
    // Put your URLS into an array and json_encode them.
        
    $encodedDomains json_encode($batchedDomains);

        
    // Use Curl to send off your request.
        // Send your encoded list of domains through Curl's POSTFIELDS.
        
    $options = array(
           
    CURLOPT_RETURNTRANSFER => true,
           
    CURLOPT_POSTFIELDS     => $encodedDomains
           
    );

        
    $ch curl_init($requestUrl);
        
    curl_setopt_array($ch$options);
        
    $content curl_exec($ch);
        
    curl_close$ch );

        
    $contents json_decode($content);
       
    $counter =0;
        foreach (
    $contents as $obj){
            
    $domain $obj->uu;
            
    $da $obj->pda;    $da round($da,2);
            
    $pa $obj->upa;    $pa round($pa,2);
            if (
    $domain == ""$domain trim($batchedDomains[$counter]);
           if (
    $domain == "") exit;
            echo 
    "$domain|$da|$pa<br>";
           
    ob_flush(); flush();
            
    $counter++;
        }

    }

    ?>
    So the output will now be :

    URL | DA | PA
     
    • Thanks Thanks x 1
  11. redbandit

    redbandit Power Member

    Joined:
    Sep 30, 2014
    Messages:
    537
    Likes Received:
    108
    Location:
    BHW
    could someone help me on how and where to run this script please?
     
  12. SpoonFeeder

    SpoonFeeder Senior Member

    Joined:
    Mar 19, 2017
    Messages:
    999
    Likes Received:
    787
    Gender:
    Male
    Occupation:
    SpoonFeeding & Babysitting the Noobs.
    Location:
    Click the link below if you're new to BHW!
    Home Page:
    Here I come!

    It's a PHP script and you need a web server to execute it. If you don't have a hosting account, install WAMP and execute the script locally from your PC/Laptop.

    Here's a short tutorial for WAMP.

    Code:
    http://www.homeandlearn.co.uk/php/php1p3.html
     
    • Thanks Thanks x 1
  13. redbandit

    redbandit Power Member

    Joined:
    Sep 30, 2014
    Messages:
    537
    Likes Received:
    108
    Location:
    BHW

    Holla and thanks!
     
  14. ebiz101

    ebiz101 Jr. VIP Jr. VIP

    Joined:
    Feb 16, 2010
    Messages:
    580
    Likes Received:
    135
    the most common place to run this script is your regular cpanel hosting.. just copy & paste the script to your hosting, edit the moz key, and you're set
     
    • Thanks Thanks x 1
  15. redbandit

    redbandit Power Member

    Joined:
    Sep 30, 2014
    Messages:
    537
    Likes Received:
    108
    Location:
    BHW

    Cool thanks a mil
     
  16. louiseluo

    louiseluo Newbie

    Joined:
    Jan 20, 2017
    Messages:
    13
    Likes Received:
    2
    Andrew,why you do not reply me?Why you do not provide any service?Please contact me or refund my money!Thanks!
     
  17. tophi

    tophi Jr. VIP Jr. VIP

    Joined:
    Sep 7, 2012
    Messages:
    503
    Likes Received:
    98
    Hm any updates on this, I get Zero ... Result:
    google.com|0

    for any domain. Api is working on my SB plugin and other software.
     
  18. jasperq

    jasperq Newbie

    Joined:
    May 26, 2014
    Messages:
    7
    Likes Received:
    2
    Just tried the PHP script in post #10, with a newly created account -- didn't work immediately. Waited 10 minutes and tried again and it works. Moz does say on creating a new API key that it takes about 20 minutes for this key to filter to all their servers.

    google.com/|100|96.46
     
    • Thanks Thanks x 1
  19. tophi

    tophi Jr. VIP Jr. VIP

    Joined:
    Sep 7, 2012
    Messages:
    503
    Likes Received:
    98
    As I said it woks on the other places where I put the API which btw is maybe 3 years old.
     
  20. Algorithm</>

    Algorithm</> Junior Member

    Joined:
    Jun 2, 2017
    Messages:
    173
    Likes Received:
    10
    Gender:
    Male
    Occupation:
    Blogging, Programming, Network Marketer
    Location:
    Nigeria
    Thanks for this free script bro