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


PHP Curl::response方法代码示例

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


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

示例1: getToken

 public function getToken()
 {
     $username = self::CONFIG_USERNAME;
     $password = self::CONFIG_PASSWORD;
     $time = time();
     $hash = md5("{$username}@{$password}@{$time}");
     $auth = "{$username}@{$time}@{$hash}";
     $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
     $url = 'http://axe.mappy.com/1v1/token/generate.aspx?' . 'auth=' . urlencode($auth) . '&' . 'ip=' . urldecode($ip);
     /**
             $remote = @fopen($url, 'rb');
     
             if ( false === $remote )
        return false;
     
             $token = '';
     
             while ( !( feof($remote) ) )
        $token .= fread($remote, 8192);
     
             fclose($remote);
     */
     $curl = new Curl($url);
     $curl->request();
     $resp = $curl->response();
     $curl->disconnect();
     return $resp['body'];
 }
开发者ID:joksnet,项目名称:php-old,代码行数:28,代码来源:Mappy.php

示例2: request

 protected function request($url)
 {
     $curl = new Curl($url);
     $curl->request();
     $this->response = $curl->response();
     $curl->disconnect();
     if ($this->response['status']) {
         if ($this->response['status']['code'] == 200) {
             return $this->response['body'];
         }
         throw new Exception($this->response['status']['message'], $this->response['status']['code']);
     }
     throw new Exception('Error!');
 }
开发者ID:joksnet,项目名称:php-old,代码行数:14,代码来源:OAuth.php

示例3: request

 protected function request($url, $post = false)
 {
     if (true === $post || is_array($post)) {
         $curl = new Curl($url, CURLOPT_POST, true === $post ? array() : $post);
     } else {
         $curl = new Curl($url);
     }
     $curl->request();
     $this->response = $curl->response();
     $curl->disconnect();
     if ($this->response['status']) {
         if ($this->response['status']['code'] == 200) {
             return $this->response['body'];
         }
         throw new Exception($this->response['status']['message'], $this->response['status']['code']);
     }
     throw new Exception('Error!');
 }
开发者ID:joksnet,项目名称:php-old,代码行数:18,代码来源:OAuth.php

示例4: request

 /**
  *   Request
  *
  *   @static
  *   @private
  *   @param $url
  *   @return bool
  */
 private static function request($url)
 {
     if (!self::$ready) {
         return false;
     }
     $url = mb_strtolower($url);
     self::$content = '';
     self::$raw = '';
     self::$response = array();
     if (stristr($url, 'https')) {
         curl_setopt_array(self::$conn, array(CURLOPT_SSLVERSION => 3, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false));
     }
     $headers = array();
     if (self::$headers) {
         foreach (self::$headers as $name => $value) {
             $headers[] = $name . ': ' . $value;
         }
     }
     curl_setopt(self::$conn, CURLOPT_HTTPHEADER, $headers);
     if (self::$cookies) {
         $cookies = array();
         foreach (self::$cookies as $name => $value) {
             $cookies[] = $name . '=' . $value;
         }
         $cookies = implode('; ', $cookies);
         curl_setopt(self::$conn, CURLOPT_COOKIE, $cookies);
     }
     curl_setopt(self::$conn, CURLOPT_URL, $url);
     $response = curl_exec(self::$conn);
     $request = curl_getinfo(self::$conn, CURLINFO_HEADER_OUT);
     self::$request = curl_getinfo(self::$conn);
     if ($response) {
         $sections = explode("\r\n\r\n", $response, self::$request['redirect_count'] + 2);
         self::$content = array_pop($sections);
         self::$raw = $response;
         self::parseHeaders($sections);
     }
     return self::$content;
 }
开发者ID:nickon,项目名称:curl,代码行数:47,代码来源:curl.php


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