/** * @access public * @return string Returns string, containing the average load time of the URL from Alexa. */ public function Alexa_Avg_Load_Time() { return SEOstats_Alexa::Alexa_Load_Time($this->url); }
/** * @access public * @return string Returns string, containing the average load time of the URL from Alexa. */ public static function Alexa_Load_Time($uri) { $str = SEOstats_Alexa::_alexa($uri); $html = new DOMDocument(); @$html->loadHtml($str); $xpath = new DOMXPath($html); $p = $xpath->query("//div[@class='speedAd']//div//p"); foreach ($p as $match) { if (preg_match('/Seconds/si', $match->textContent)) { return trim(strip_tags($match->textContent)); exit; } } return 'No data available.'; }