當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Auth_Yadis_Yadis::curlPresent方法代碼示例

本文整理匯總了PHP中Auth_Yadis_Yadis::curlPresent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Auth_Yadis_Yadis::curlPresent方法的具體用法?PHP Auth_Yadis_Yadis::curlPresent怎麽用?PHP Auth_Yadis_Yadis::curlPresent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Auth_Yadis_Yadis的用法示例。


在下文中一共展示了Auth_Yadis_Yadis::curlPresent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getHTTPFetcher

 /**
  * Returns an HTTP fetcher object.  If the CURL extension is
  * present, an instance of {@link Auth_Yadis_ParanoidHTTPFetcher}
  * is returned.  If not, an instance of
  * {@link Auth_Yadis_PlainHTTPFetcher} is returned.
  *
  * If Auth_Yadis_CURL_OVERRIDE is defined, this method will always
  * return a {@link Auth_Yadis_PlainHTTPFetcher}.
  */
 function getHTTPFetcher($timeout = 20)
 {
     if (Auth_Yadis_Yadis::curlPresent() && !defined('Auth_Yadis_CURL_OVERRIDE')) {
         $fetcher = new Auth_Yadis_ParanoidHTTPFetcher($timeout);
     } else {
         $fetcher = new Auth_Yadis_PlainHTTPFetcher($timeout);
     }
     return $fetcher;
 }
開發者ID:ashishvazirani,項目名稱:food,代碼行數:18,代碼來源:Yadis.php

示例2: detect_fetcher

function detect_fetcher($r, &$out)
{
    $out .= $r->h2('HTTP Fetching');
    $result = @(include 'Auth/Yadis/Yadis.php');
    if (!$result) {
        $out .= $r->p('Yadis code unavailable; could not test fetcher support.');
        return false;
    }
    if (Auth_Yadis_Yadis::curlPresent()) {
        $out .= $r->p('This PHP installation has support for libcurl. Good.');
    } else {
        $out .= $r->p('This PHP installation does not have support for ' . 'libcurl. CURL is not required but is recommended. ' . 'The OpenID library will use an fsockopen()-based fetcher.');
        $lnk = $r->link('http://us3.php.net/manual/en/ref.curl.php');
        $out .= $r->p('See ' . $lnk . ' about enabling the libcurl support ' . 'for PHP.');
    }
    $ok = true;
    $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
    $fetch_url = 'http://www.openidenabled.com/resources/php-fetch-test';
    $expected_url = $fetch_url . '.txt';
    $result = $fetcher->get($fetch_url);
    if (isset($result)) {
        $parts = array('An HTTP request was completed.');
        // list ($code, $url, $data) = $result;
        if ($result->status != '200') {
            $ok = false;
            $parts[] = $r->b(sprintf('Got %s instead of the expected HTTP status code ' . '(200).', $result->status));
        }
        $url = $result->final_url;
        if ($url != $expected_url) {
            $ok = false;
            if ($url == $fetch_url) {
                $msg = 'The redirected URL was not returned.';
            } else {
                $msg = 'An unexpected URL was returned: <' . $url . '>.';
            }
            $parts[] = $r->b($msg);
        }
        $data = $result->body;
        if ($data != 'Hello World!') {
            $ok = false;
            $parts[] = $r->b('Unexpected data was returned.');
        }
        $out .= $r->p(implode(' ', $parts));
    } else {
        $ok = false;
        $out .= $r->p('Fetching URL ' . $lnk . ' failed!');
    }
    if ($fetcher->supportsSSL()) {
        $out .= $r->p('Your PHP installation appears to support SSL, so it ' . 'will be able to process HTTPS identity URLs and server URLs.');
    } else {
        $out .= $r->p('Your PHP installation does not support SSL, so it ' . 'will NOT be able to process HTTPS identity URLs and server URLs.');
    }
    return $ok;
}
開發者ID:Jobava,項目名稱:diacritice-meta-repo,代碼行數:54,代碼來源:detect.php


注:本文中的Auth_Yadis_Yadis::curlPresent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。