更新Helper\Curl和Helper\Table类

This commit is contained in:
Li Jianxuan 2013-11-21 02:14:36 +00:00
parent 608b8f29f4
commit dbe4d9d728
2 changed files with 22 additions and 7 deletions

View File

@ -4,21 +4,25 @@ namespace Helpers;
class Curl class Curl
{ {
private $options; private $options;
public $port = 80;
public $H;
public function __construct($options = array()) public function __construct($options = array())
{
}
public function initOptions($options = array())
{ {
$this->options = array_merge(array( $this->options = array_merge(array(
'debug' => false, 'debug' => false,
'http_port' => '80', 'http_port' => $this->port,
'user_agent' => 'Westdc DataService', 'user_agent' => 'Westdc DataService',
'timeout' => 20, 'timeout' => 20,
'curlopts' => null, 'curlopts' => null,
'verifyssl' => true, 'verifyssl' => true,
), $options); ), $options);
} }
public $H;
/** /**
* Send a request to the server, receive a response * Send a request to the server, receive a response
* *
@ -89,6 +93,16 @@ class Curl
CURLOPT_SSL_VERIFYPEER => $options['verifyssl'], 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') { if (ini_get('open_basedir') == '' && ini_get('safe_mode') != 'On') {
$curlOptions[CURLOPT_FOLLOWLOCATION] = true; $curlOptions[CURLOPT_FOLLOWLOCATION] = true;
} }

View File

@ -26,5 +26,6 @@ class Table
//开放平台 //开放平台
public $oauth_clients = "oauth_clients"; public $oauth_clients = "oauth_clients";
public $oauth_token = "oauth_login_token";
public $oauth_access_tokens = "oauth_access_tokens"; public $oauth_access_tokens = "oauth_access_tokens";
} }