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


PHP URLBuilder::buildAssociate方法代码示例

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


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

示例1: associate

 public static function associate($server)
 {
     $data = URLBuilder::buildAssociate($server);
     try {
         $res = Poster::post($server, $data);
     } catch (Exception $ex) {
         return;
     }
     $data = array();
     foreach (explode("\n", $res) as $line) {
         if (preg_match('/^(.*?):(.*)$/', $line, $m)) {
             $data[$m[1]] = $m[2];
         }
     }
     $data['expires_at'] = time() + $data['expires_in'];
     self::$data[$server][$data['assoc_handle']] = $data;
     self::saveData();
 }
开发者ID:jvinet,项目名称:pronto,代码行数:18,代码来源:keymanager.inc.php

示例2: associate

 /**
  * Attempts to associate with the specified server.
  *
  * @param String $server The server to associate with
  */
 public static function associate($server, $assocType = null, $sessionType = null)
 {
     Logger::log('Attempting to associate with %s, assocType: %s, sessionType: %s', $server, $assocType, $sessionType);
     $data = URLBuilder::buildAssociate($server, $_SESSION['openid']['version'], $assocType, $sessionType);
     try {
         $res = Poster::post($server, $data);
     } catch (Exception $ex) {
         Logger::log('Exception while posting: %s', $ex->getMessage());
         return;
     }
     $data = array();
     foreach (explode("\n", $res) as $line) {
         if (preg_match('/^(.*?):(.*)$/', $line, $m)) {
             $data[$m[1]] = $m[2];
         }
     }
     if (isset($data['error_code']) && $data['error_code'] == 'unsupported-type') {
         $cont = false;
         if (isset($data['session_type']) && $data['session_type'] != $sessionType) {
             // TODO: Check we support it before actually trying
             $sessionType = $data['session_type'];
             $cont = true;
         }
         if (isset($data['assoc_type']) && $data['assoc_type'] != $assocType) {
             $assocType = $data['assoc_type'];
             $cont = true;
         }
         if ($cont) {
             self::associate($server, $assocType, $sessionType);
         }
         return;
     }
     try {
         $data = self::decodeKey($server, $data);
     } catch (Exception $ex) {
         return;
     }
     $data['expires_at'] = time() + $data['expires_in'];
     self::$data[$server][$data['assoc_handle']] = $data;
     self::saveData();
 }
开发者ID:emma5021,项目名称:toba,代码行数:46,代码来源:keymanager.inc.php


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