minhajoptimal / seostats

Automatically exported from code.google.com/p/seostats
0 stars 0 forks source link

Majestic SEO #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which method(/function) produce a problem?
1.MajesticSEO Data is wrong

Does the method(/function) produce the problem for all given URL's? Yes
(If not, what specific URL produces the problem?)
1.

Please provide any additional information below:

When loading the Magestic SEO Methods, it returns incorrect data. Here is what 
is shown for Amazon.com:
Site Index Total:   Governmental
Total Backlinks:    367,200,322
Backlinking Domains:    1,230,166
Backlinking IPs:    198,718
Backlinking CSubnets:   Educational

As you can see, Site Index Total is read in as Text instead of the actual 
value, I believe it has something to do with the changes made on this: 
http://www.majesticseo.com/reports/site-explorer/summary/amazon.com page.

Original issue reported on code.google.com by CAlva...@gmail.com on 2 Jun 2011 at 4:50

GoogleCodeExporter commented 9 years ago
Here is what I used to fix the issue, however, I am thinking this is more of a 
temporary fix.

    public static function report($uri, $i)
    {
        $tmp = SEOstats::cURL( 'http://www.majesticseo.com/reports/site-explorer/summary/'.
            str_replace('http://', '', $uri) );

        preg_match_all('#(.*?)#',$tmp,$matches);

        return self::validateReport($matches[1], $i);
    }

    public static function validateReport($data, $i)
    {
        if($i >= sizeof($data)) return 0;
        if($i <= 1) return $data[$i];

        $count = 0;
        for($r=2;$r<16;$r++)
        {
            //check for education or governemntal
            if($data[$r] == "Educational" || $data[$r] == "Governmental") $count++;

        }
        $i+= $count*2;

        if($i >= sizeof($data)) return 0;
        return $data[$i];

    }

Original comment by CAlva...@gmail.com on 3 Jun 2011 at 8:52

GoogleCodeExporter commented 9 years ago
Although posting a thank you is maybe not suitable, I'd anyways express my 
thanks - was just about to write an email about this issue. Thanks for the 
quick fix.

Original comment by designst...@googlemail.com on 5 Jun 2011 at 5:59

GoogleCodeExporter commented 9 years ago
I found a bug with my code. The final code should look like this: 

<?php
    /**
     *  PHP class SEOstats
     *
     *  @class      SEOstats_Majesticseo
     *  @package    class.seostats
     *  @updated    2011/04/29
     *  @author     Stephan Schmitz <eyecatchup@gmail.com>
     *  @copyright  2010-present, Stephan Schmitz
     *  @license    GNU General Public License (GPL)
     */

class SEOstats_Majesticseo extends SEOstats {

    /**
     * Helper. Gets the Majesticseo's free report webpage.
     *
     * @access      private
     * @return      string                  String, containing the curl result of the the Majesticseo webpage.
     */
    public static function report($uri, $i)
    {
        $tmp = SEOstats::cURL( 'http://www.majesticseo.com/reports/site-explorer/summary/'.
            str_replace('http://', '', $uri) );

        preg_match_all('#(.*?)#',$tmp,$matches);

        return self::validateReport($matches[1], $i);
    }

    public static function validateReport($data, $i)
    {
        $sizeOfData = sizeof($data);
        if($i >= $sizeOfData) return 0;
        if($i <= 1) return $data[$i];

        $count = 0;
        for($r=2;$r<16;$r++)
        {

            if($r < $sizeOfData)
            {
                //check for education or governemntal
                if($data[$r] == "Educational" || $data[$r] == "Governmental") $count++;
            }
        }
        $i+= $count*2;

        if($i >= sizeof($data)) return 0;
        return $data[$i];

    }
}

?>

Original comment by CAlva...@gmail.com on 7 Jun 2011 at 4:32

GoogleCodeExporter commented 9 years ago
@ CAlva...@gmail.com: sorry for beeinträchtigt late in response, but i've just 
been too busy at work to check out what's going here.

Thank you for the feedback and another big thanks for the fix (and helping 
other users with that as well)!! I will verify the code and update the class 
tomorrow. 

Regards

Original comment by eyecatchup@gmail.com on 7 Jun 2011 at 10:57

GoogleCodeExporter commented 9 years ago
:D sorry, can not (!?) edit my own comments ..  beeinträchtigt should read 
being (all credit goes to android's  autocomplete)

Original comment by eyecatchup@gmail.com on 7 Jun 2011 at 11:03

GoogleCodeExporter commented 9 years ago
Thanks for your fix again, eventhough i did not implemented it. But i decided 
to switch from regular expressions to xpath and also to avoid calling yet 
another method.

This is, what i've done: 
http://code.google.com/p/seostats/#seostats.majesticseo.php

Updated version includes some more fixes and two new methods: 
http://code.google.com/p/seostats/#Changelog

Cheers

Original comment by eyecatchup@gmail.com on 11 Jun 2011 at 7:35