本文整理汇总了PHP中UrlHelper::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlHelper::getHost方法的具体用法?PHP UrlHelper::getHost怎么用?PHP UrlHelper::getHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlHelper
的用法示例。
在下文中一共展示了UrlHelper::getHost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVisibilityIndex
/**
* 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 function getVisibilityIndex($url = false)
{
$url = false != $url ? $url : self::getUrl();
$domain = UrlHelper::getHost($url);
$dataUrl = sprintf(services::SISTRIX_VI_URL, urlencode($domain));
$html = HttpRequest::sendRequest($dataUrl);
preg_match_all('#<h3>(.*?)<\\/h3>#si', $html, $matches);
return isset($matches[1][0]) ? $matches[1][0] : intval('0');
}
示例2: getUrlReferrer
public function getUrlReferrer()
{
$referrer = parent::getUrlReferrer();
$host = UrlHelper::getHost($referrer);
if ($host === $this->getServerName()) {
return $referrer;
} else {
return UrlHelper::createAbsoluteUrl('/shop');
}
}
示例3: _getAlexaPage
private function _getAlexaPage($url)
{
$domain = UrlHelper::getHost($url);
$dataUrl = sprintf(services::ALEXA_SITEINFO_URL, $domain);
return HttpRequest::sendRequest($dataUrl);
}
示例4: getWidgetUrl
private function getWidgetUrl($url, $db, $reportType)
{
$url = false != $url ? $url : self::getUrl();
$domain = UrlHelper::getHost($url);
$database = self::checkDatabase($db);
if (false === $domain) {
self::exc('Invalid domain name.');
} else {
if (false === $database) {
self::exc('db');
} else {
$widgetUrl = services::SEMRUSH_WIDGET_URL;
return sprintf($widgetUrl, $reportType, $database, $domain);
}
}
}