Skip to content

Commit

Permalink
Merge pull request eyecatchup#107 from iamdual/patch-1
Browse files Browse the repository at this point in the history
[Mod] Add "country_code" to Alexa::getCountryRank() result.
  • Loading branch information
eyecatchup committed Jul 13, 2015
2 parents 04d0345 + 49c3b5b commit 8a46542
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SEOstats/Services/Alexa.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
}
Expand Down

0 comments on commit 8a46542

Please sign in to comment.