/** * Returns the Sistrix visibility index * * @access public * @param url string The URL to check. * @return integer Returns the Sistrix visibility index. * @link http://www.sistrix.com/blog/870-sistrix-visibilityindex.html */ public static function getVisibilityIndex($url = false) { $url = parent::getUrl($url); $domain = Helper\Url::parseHost($url); $dataUrl = sprintf(Config\Services::SISTRIX_VI_URL, urlencode($domain)); $html = parent::_getPage($dataUrl); @preg_match_all('#<h3>(.*?)<\\/h3>#si', $html, $matches); return isset($matches[1][0]) ? $matches[1][0] : parent::noDataDefaultValue(); }
/** * Return Link metrics from the (free) Mozscape (f.k.a. Seomoz) API. * * @access public * @param cols string The bit flags you want returned. * @param url string The URL to get metrics for. */ public static function getCols($cols, $url = false) { if ('' == Config\ApiKeys::MOZSCAPE_ACCESS_ID || '' == Config\ApiKeys::MOZSCAPE_SECRET_KEY) { throw new E('In order to use the Mozscape API, you must obtain and set an API key first (see SEOstats\\Config\\ApiKeys.php).'); exit(0); } $expires = time() + 300; $apiEndpoint = sprintf(Config\Services::MOZSCAPE_API_URL, urlencode(Helper\Url::parseHost(parent::getUrl($url))), $cols, Config\ApiKeys::MOZSCAPE_ACCESS_ID, $expires, urlencode(self::_getUrlSafeSignature($expires))); $ret = parent::_getPage($apiEndpoint); return !$ret || empty($ret) || '{}' == (string) $ret ? parent::noDataDefaultValue() : Helper\Json::decode($ret, true); }
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(); } }
public static function getPageMetrics($url = false) { $url = parent::getUrl($url); $dataUrl = sprintf(Config\Services::OPENSITEEXPLORER_URL, 'links', '1', urlencode($url)); $html = parent::_getPage($dataUrl); $doc = parent::_getDOMDocument($html); $xpath = parent::_getDOMXPath(@$doc); $tooltipNodes = @$xpath->query('//*[@class="tooltip"]'); $resultNodes = @$xpath->query('//*[@class="has-tooltip"]'); $resultNodes2 = @$xpath->query('//*[@class="has-tooltip"]/span[1]'); $unitNodes = @$xpath->query('//*[@class="has-tooltip"]/span[2]'); if (0 < $resultNodes->length) { return (object) array('domainAuthority' => (object) array('result' => intval($resultNodes2->item(0)->nodeValue), 'unit' => trim(strip_tags($unitNodes->item(0)->nodeValue)), 'descr' => trim(strip_tags($tooltipNodes->item(0)->nodeValue))), 'pageAuthority' => (object) array('result' => intval($resultNodes2->item(1)->nodeValue), 'unit' => trim(strip_tags($unitNodes->item(1)->nodeValue)), 'descr' => trim(strip_tags($tooltipNodes->item(1)->nodeValue))), 'justDiscovered' => (object) array('result' => intval(str_replace(',', '', strip_tags($resultNodes->item(2)->nodeValue))), 'unit' => trim(strip_tags($resultNodes2->item(2)->nodeValue)), 'descr' => trim(strip_tags($tooltipNodes->item(2)->nodeValue))), 'linkingRootDomains' => (object) array('result' => intval(str_replace(',', '', $resultNodes->item(3)->nodeValue)), 'unit' => trim(strip_tags($resultNodes2->item(3)->nodeValue)), 'descr' => trim(strip_tags($tooltipNodes->item(3)->nodeValue))), 'totalLinks' => (object) array('result' => intval(str_replace(',', '', $resultNodes->item(4)->nodeValue)), 'unit' => trim(strip_tags($resultNodes2->item(4)->nodeValue)), 'descr' => trim(strip_tags($tooltipNodes->item(4)->nodeValue)))); } else { return parent::noDataDefaultValue(); } }
private static function _getAlexaPage($url) { $domain = Helper\Url::parseHost($url); $dataUrl = sprintf(Config\Services::ALEXA_SITEINFO_URL, $domain); $html = parent::_getPage($dataUrl); return $html; }
/** * Returns the total count of URL shares via VKontakte * * @access public * @param url string The URL to check. * @return integer Returns the total count of URL shares. */ public static function getVKontakteShares($url = false) { $url = parent::getUrl($url); $dataUrl = sprintf(Config\Services::VKONTAKTE_INFO_URL, urlencode($url)); $htmlData = parent::_getPage($dataUrl); @preg_match_all('#^VK\\.Share\\.count\\(1, (\\d+)\\);$#si', $htmlData, $matches); return isset($matches[1][0]) ? intval($matches[1][0]) : parent::noDataDefaultValue(); }
/** * Returns an array of interaction counts (shares, comments, clicks, reach) for host of $url on Xing. * * @access public * @param url string The URL to check. * @return array Returns URL shares, comments, clicks and 'reach'. * @link https://blog.xing.com/2012/01/xing-share-button/ Return values explained (German) */ public static function getXingShares($url = false) { $host = parent::getHost($url); $dataUrl = sprintf(Config\Services::XING_SHAREBUTTON_URL, urlencode($host)); $htmlData = parent::_getPage($dataUrl); @preg_match_all('/\\r?\\n(\\d+)\\r?\\n/s', $htmlData, $matches); if (isset($matches[1]) && 4 == sizeof($matches[1])) { return array('shares' => intval($matches[1][0]), 'comments' => intval($matches[1][1]), 'clicks' => intval($matches[1][2]), 'reach' => intval($matches[1][3])); } return parent::noDataDefaultValue(); }
private static function getApiData($url) { $json = parent::_getPage($url); return Helper\Json::decode($json, true); }
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); }