/** * 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); }
private static function _getAlexaPage($url) { $domain = Helper\Url::parseHost($url); $dataUrl = sprintf(Config\Services::ALEXA_SITEINFO_URL, $domain); $html = parent::_getPage($dataUrl); return $html; }
protected static function getDomainFromUrl($url) { $url = parent::getUrl($url); $domain = Helper\Url::parseHost($url); static::guardDomainIsValid($domain); return $domain; }
/** * * @dataProvider providerTestParseHost */ public function testParseHost($url, $assertHost) { $host = Url::parseHost($url); $this->assertEquals($assertHost, $host); }
private static function getWidgetUrl($url, $db, $reportType) { $url = parent::getUrl($url); $domain = Helper\Url::parseHost($url); $database = self::checkDatabase($db); if (false === $domain) { self::exc('Invalid domain name.'); } else { if (false === $database) { self::exc('db'); } else { $widgetUrl = Config\Services::SEMRUSH_WIDGET_URL; return sprintf($widgetUrl, $reportType, $database, $domain); } } }
public static function getHost($url = false) { return Helper\Url::parseHost(self::getUrl($url)); }