From dbe4d9d728b9c2333b6a0acbe63535fd8155d476 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 21 Nov 2013 02:14:36 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Helper\Curl=E5=92=8CHelper\Ta?= =?UTF-8?q?ble=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/module/Helpers/Curl.php | 28 +++++++++++++++++++++------- application/module/Helpers/Table.php | 1 + 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/application/module/Helpers/Curl.php b/application/module/Helpers/Curl.php index dea71661..f801e43d 100644 --- a/application/module/Helpers/Curl.php +++ b/application/module/Helpers/Curl.php @@ -4,21 +4,25 @@ namespace Helpers; class Curl { private $options; - + public $port = 80; + public $H; + public function __construct($options = array()) { - $this->options = array_merge(array( + + } + + public function initOptions($options = array()) + { + $this->options = array_merge(array( 'debug' => false, - 'http_port' => '80', + 'http_port' => $this->port, 'user_agent' => 'Westdc DataService', 'timeout' => 20, 'curlopts' => null, 'verifyssl' => true, ), $options); - } - - public $H; - + } /** * Send a request to the server, receive a response * @@ -88,6 +92,16 @@ class Curl CURLOPT_HTTPHEADER => $headers, CURLOPT_SSL_VERIFYPEER => $options['verifyssl'], ); + + if($this->port === 443) + { + /*$curlOptions += array( + CURLOPT_SSLVERSION => 3, + CURLOPT_SSLCERT => "../application/module/Open/apache.pem", + CURLOPT_SSLKEY => "../application/module/Open/apache.key", + CURLOPT_CAINFO => "../application/module/Open/apache.pem" + );*/ + } if (ini_get('open_basedir') == '' && ini_get('safe_mode') != 'On') { $curlOptions[CURLOPT_FOLLOWLOCATION] = true; diff --git a/application/module/Helpers/Table.php b/application/module/Helpers/Table.php index 69256584..15bab0fb 100644 --- a/application/module/Helpers/Table.php +++ b/application/module/Helpers/Table.php @@ -26,5 +26,6 @@ class Table //开放平台 public $oauth_clients = "oauth_clients"; + public $oauth_token = "oauth_login_token"; public $oauth_access_tokens = "oauth_access_tokens"; } \ No newline at end of file