Closed GoogleCodeExporter closed 8 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
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
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
@ 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
: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
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
Original issue reported on code.google.com by
CAlva...@gmail.com
on 2 Jun 2011 at 4:50