NagamaniNaresh / seostats

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

Url with folder are not allowed in MajesticSEO #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which method(/function) produce a problem?
1.function report($uri, $i)

Does the method(/function) produce the problem for all given URL's?
(If not, what specific URL produces the problem?)
1. URL fool wed by a folder . example : http://apple.com/mac

Please provide any additional information below:

MajesticSEO treats differently the URL of domains followed by folders and 
redirect to the url : 
http://www.majesticseo.com/reports/site-explorer?folder=&q=apple.com%2Ffolder 
instead of http://www.majesticseo.com/reports/site-explorer/summary/apple.com

I decided to fix by modifying 2 parts in the function :

/**
     * 2 modified parts by Florent Cima <florentcm@gmail.com> in order to allow the URL with FOLDER :
     * $folder allow to treat separately when the url contains a folder : example http://apple.com/support.
     * The modified part 1 check if the URL contains the character '/' and if it's not at the end of the URL. It choose another another majesticseo URL if the URL contains a folder.
     * The modified part 2 trat separately the URL with folder because of the position of the 'p' item in the modified url page with folder ('http://www.majesticseo.com/reports/site-explorer?folder=&q=.url' (with folder). i + 4
     */
    public static function report($uri, $i)
    {

        //// Beginning of the modified part 1 ////

        $uri = str_replace('http://', '', $uri);
        $folder = false;
        $tmp = SEOstats::cURL( 'http://www.majesticseo.com/reports/site-explorer/summary/'.$uri );

        if((ereg('/',$uri)) && (strpos($uri,'/') != strlen($uri)-1))
        {
            $folder = true; 
            $uri = str_replace('/', '%2F', $uri);
            $tmp = SEOstats::cURL( 'http://www.majesticseo.com/reports/site-explorer?folder=&q='.$uri );
        }

        //// End of the modified part 1 ////

        $dom = new DOMDocument();
        @$dom->loadHTML($tmp);
        $xpath = new DOMXPath($dom);

        $p = $xpath->query("//table//tr//td//p");

            if($i==1 || $i==3)
            {
        //// Begginning of the modified part 2 ////
                if ($folder == true) 
                {
                    $r = trim($p->item($i+4)->textContent); 
                }else{
                    $r = trim($p->item($i)->textContent);
                }
                $r = str_replace(",","",$r);
        //// End of the modified part 2 ////
            } 
            else
            {

Original issue reported on code.google.com by floren...@gmail.com on 21 Jul 2011 at 6:28

Attachments:

GoogleCodeExporter commented 9 years ago
Implemented on GitHub repo

Original comment by eyecatchup@gmail.com on 4 Aug 2011 at 1:41