Esempio n. 1
0
 public static function getPagespeedAnalysis($url = false)
 {
     if ('' == Config\ApiKeys::GOOGLE_SIMPLE_API_ACCESS_KEY) {
         throw new E('In order to use the PageSpeed API, you must obtain
             and set an API key first (see SEOstats\\Config\\ApiKeys.php).');
         exit(0);
     }
     $url = parent::getUrl($url);
     $url = sprintf(Config\Services::GOOGLE_PAGESPEED_URL, $url, Config\ApiKeys::GOOGLE_SIMPLE_API_ACCESS_KEY);
     $ret = parent::_getPage($url);
     return Helper\Json::decode($ret);
 }
 public static function getPageMetrics($url = false)
 {
     $url = parent::getUrl($url);
     $dataUrl = sprintf(Config\Services::OPENSITEEXPLORER_URL, 'links', '1', $url);
     $html = parent::_getPage($dataUrl);
     $doc = parent::_getDOMDocument($html);
     $data = @$doc->getElementsByTagName('td');
     if ($data->item(0)) {
         return array('domainAuthority' => trim(strip_tags($data->item(0)->textContent)), 'pageAuthority' => trim(strip_tags($data->item(1)->textContent)), 'linkingRootDomains' => trim(strip_tags($data->item(2)->textContent)), 'totalInboundLinks' => trim(strip_tags($data->item(3)->textContent)));
     } else {
         return parent::noDataDefaultValue();
     }
 }
Esempio n. 3
0
 private static function getApiData($url)
 {
     $json = parent::_getPage($url);
     return Helper\Json::decode($json, true);
 }