当前位置: 首页>>代码示例>>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;未经允许,请勿转载。