diff --git a/SEOstats/Services/Alexa.php b/SEOstats/Services/Alexa.php index 66c607b6..cb1f6c2e 100644 --- a/SEOstats/Services/Alexa.php +++ b/SEOstats/Services/Alexa.php @@ -184,12 +184,19 @@ public static function getCountryRank($url = false) "//*[@id='traffic-rank-content']/div/span[2]/div[2]/span/span/div/strong", )); + $node3 = self::parseDomByXpaths($xpath, array( + "//*[@id='traffic-rank-content']/div/span[2]/div[2]/span/span/h4/a/@href", + "//*[@id='traffic-rank-content']/div/span[2]/div[2]/span/span/h4/strong/a/@href", + )); + if (!is_null($node2) && $node2->item(0)) { $rank = self::retInt(strip_tags($node2->item(0)->nodeValue)); + $country_code = str_replace("/topsites/countries/", "", $node3->item(0)->nodeValue); if ($node1->item(0) && 0 != $rank) { return array( 'rank' => $rank, 'country' => $node1->item(0)->nodeValue, + 'country_code' => $country_code, ); } }