当前位置: 首页>>代码示例>>PHP>>正文


PHP Auth_Yadis_Yadis::_getContentType方法代码示例

本文整理汇总了PHP中Auth_Yadis_Yadis::_getContentType方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth_Yadis_Yadis::_getContentType方法的具体用法?PHP Auth_Yadis_Yadis::_getContentType怎么用?PHP Auth_Yadis_Yadis::_getContentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Auth_Yadis_Yadis的用法示例。


在下文中一共展示了Auth_Yadis_Yadis::_getContentType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: discover

 /**
  * This should be called statically and will build a Yadis
  * instance if the discovery process succeeds.  This implements
  * Yadis discovery as specified in the Yadis specification.
  *
  * @param string $uri The URI on which to perform Yadis discovery.
  *
  * @param array $http_response An array reference where the HTTP
  * response object will be stored (see {@link
  * Auth_Yadis_HTTPResponse}.
  *
  * @param Auth_Yadis_HTTPFetcher $fetcher An instance of a
  * Auth_Yadis_HTTPFetcher subclass.
  *
  * @param array $extra_ns_map An array which maps namespace names
  * to namespace URIs to be used when parsing the Yadis XRDS
  * document.
  *
  * @param integer $timeout An optional fetcher timeout, in seconds.
  *
  * @return mixed $obj Either null or an instance of
  * Auth_Yadis_Yadis, depending on whether the discovery
  * succeeded.
  */
 function discover($uri, &$fetcher, $extra_ns_map = null, $timeout = 20)
 {
     $result = new Auth_Yadis_DiscoveryResult($uri);
     $request_uri = $uri;
     $headers = array("Accept: " . Auth_Yadis_CONTENT_TYPE . ', text/html; q=0.3, application/xhtml+xml; q=0.5');
     if ($fetcher === null) {
         $fetcher = Auth_Yadis_Yadis::getHTTPFetcher($timeout);
     }
     $response = $fetcher->get($uri, $headers);
     if (!$response || ($response->status != 200 and $response->status != 206)) {
         $result->fail();
         return $result;
     }
     $result->normalized_uri = $response->final_url;
     $result->content_type = Auth_Yadis_Yadis::_getHeader($response->headers, array('content-type'));
     if ($result->content_type && Auth_Yadis_Yadis::_getContentType($result->content_type) == Auth_Yadis_CONTENT_TYPE) {
         $result->xrds_uri = $result->normalized_uri;
     } else {
         $yadis_location = Auth_Yadis_Yadis::_getHeader($response->headers, array(Auth_Yadis_HEADER_NAME));
         if (!$yadis_location) {
             $parser = new Auth_Yadis_ParseHTML();
             $yadis_location = $parser->getHTTPEquiv($response->body);
         }
         if ($yadis_location) {
             $result->xrds_uri = $yadis_location;
             $response = $fetcher->get($yadis_location);
             if (!$response || ($response->status != 200 and $response->status != 206)) {
                 $result->fail();
                 return $result;
             }
             $result->content_type = Auth_Yadis_Yadis::_getHeader($response->headers, array('content-type'));
         }
     }
     $result->response_text = $response->body;
     return $result;
 }
开发者ID:ashishvazirani,项目名称:food,代码行数:60,代码来源:Yadis.php


注:本文中的Auth_Yadis_Yadis::_getContentType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。