本文整理匯總了PHP中HttpRequest::sendRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpRequest::sendRequest方法的具體用法?PHP HttpRequest::sendRequest怎麽用?PHP HttpRequest::sendRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::sendRequest方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getPageMetrics
public function getPageMetrics($url = false)
{
$url = false != $url ? $url : self::getUrl();
$dataUrl = sprintf(services::OPENSITEEXPLORER_URL, 'links', '1', $url);
$html = HttpRequest::sendRequest($dataUrl);
$doc = new DOMDocument();
@$doc->loadHtml($html);
$data = $doc->getElementsByTagName('td');
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)));
}
示例3: httpSendWrapper
private function httpSendWrapper($request)
{
$request .= !empty($this->cx) ? "&cx={$this->cx}&key={$this->key}" : '';
return HttpRequest::sendRequest($request);
}
示例4: _getAlexaPage
private function _getAlexaPage($url)
{
$domain = UrlHelper::getHost($url);
$dataUrl = sprintf(services::ALEXA_SITEINFO_URL, $domain);
return HttpRequest::sendRequest($dataUrl);
}
示例5: getVKontakteShares
/**
* 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 function getVKontakteShares($url = false)
{
$url = false != $url ? $url : self::getUrl();
$dataUrl = sprintf(services::VKONTAKTE_INFO_URL, urlencode($url));
$htmlData = HttpRequest::sendRequest($dataUrl);
preg_match_all('#^VK\\.Share\\.count\\(1, (\\d+)\\);$#si', $htmlData, $matches);
return isset($matches[1][0]) ? intval($matches[1][0]) : intval('0');
}
示例6: getApiData
private function getApiData($url)
{
$jsonData = HttpRequest::sendRequest($url);
return json_decode($jsonData, true);
}