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


PHP HTTP_Request::getResponseCookies方法代码示例

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


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

示例1: getRemoteResource

 function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array())
 {
     requirePear();
     require_once 'HTTP/Request.php';
     $parsed_url = parse_url(__PROXY_SERVER__);
     if ($parsed_url["host"]) {
         $oRequest = new HTTP_Request(__PROXY_SERVER__);
         $oRequest->setMethod('POST');
         $oRequest->_timeout = $timeout;
         $oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data)));
     } else {
         $oRequest = new HTTP_Request($url);
         if (count($headers)) {
             foreach ($headers as $key => $val) {
                 $oRequest->addHeader($key, $val);
             }
         }
         if ($cookies[$host]) {
             foreach ($cookies[$host] as $key => $val) {
                 $oRequest->addCookie($key, $val);
             }
         }
         if (count($post_data)) {
             foreach ($post_data as $key => $val) {
                 $oRequest->addPostData($key, $val);
             }
         }
         if (!$content_type) {
             $oRequest->addHeader('Content-Type', 'text/html');
         } else {
             $oRequest->addHeader('Content-Type', $content_type);
         }
         $oRequest->setMethod($method);
         if ($body) {
             $oRequest->setBody($body);
         }
         $oRequest->_timeout = $timeout;
     }
     $oResponse = $oRequest->sendRequest();
     $code = $oRequest->getResponseCode();
     $header = $oRequest->getResponseHeader();
     $response = $oRequest->getResponseBody();
     if ($c = $oRequest->getResponseCookies()) {
         foreach ($c as $k => $v) {
             $cookies[$host][$v['name']] = $v['value'];
         }
     }
     if ($code > 300 && $code < 399 && $header['location']) {
         return FileHandler::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
     }
     return $response;
 }
开发者ID:leehankyeol,项目名称:module-server,代码行数:52,代码来源:me2day.php

示例2: array

 function _request($url, $body = null, $content_type = 'text/html', $method = 'GET', $headers = array(), $cookies = array())
 {
     set_include_path(_XE_PATH_ . "libs/PEAR");
     require_once 'PEAR.php';
     require_once 'HTTP/Request.php';
     $url_info = parse_url($url);
     $host = $url_info['host'];
     if (__PROXY_SERVER__ !== null) {
         $oRequest = new HTTP_Request(__PROXY_SERVER__);
         $oRequest->setMethod('POST');
         $oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers)));
     } else {
         $oRequest = new HTTP_Request($url);
         if (count($headers)) {
             foreach ($headers as $key => $val) {
                 $oRequest->addHeader($key, $val);
             }
         }
         if ($cookies[$host]) {
             foreach ($cookies[$host] as $key => $val) {
                 $oRequest->addCookie($key, $val);
             }
         }
         if (!$content_type) {
             $oRequest->addHeader('Content-Type', 'text/html');
         } else {
             $oRequest->addHeader('Content-Type', $content_type);
         }
         $oRequest->setMethod($method);
         if ($body) {
             $oRequest->setBody($body);
         }
     }
     $oResponse = $oRequest->sendRequest();
     $code = $oRequest->getResponseCode();
     $header = $oRequest->getResponseHeader();
     $response = $oRequest->getResponseBody();
     if ($c = $oRequest->getResponseCookies()) {
         foreach ($c as $k => $v) {
             $cookies[$host][$v['name']] = $v['value'];
         }
     }
     if ($code > 300 && $code < 399 && $header['location']) {
         return $this->_request($header['location'], $body, $content_type, $method, $headers, $cookies);
     }
     if ($code != 200) {
         return;
     }
     return $response;
 }
开发者ID:google-code-backups,项目名称:xe-textyle,代码行数:50,代码来源:blogger.class.php

示例3: Logon

 public function Logon($username, $domain, $password)
 {
     debugLog("BackendOX::Logon ({$username}, {$password})");
     $request = new HTTP_Request(OX_URL . "/login?action=login", array("method" => "POST"));
     $request->addPostData("name", $username);
     $request->addPostData("password", $password);
     try {
         $request->sendRequest();
         if ($request->getResponseCode() == 200) {
             $reply = $this->json->decode($request->getResponseBody());
             if (isset($reply["session"])) {
                 $this->session = $reply["session"];
                 $this->cookies = $request->getResponseCookies();
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } catch (HTTP_Exception $e) {
         return false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:24,代码来源:ox.php


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