标签:init 选项 strpos out ini err 数据 ret str
//GET请求
//参数1是请求的url
//参数2是发送的数据的数组
//参数3是其他GET选项
private function curlGET($url, array $get = array(), array $options = array())
{
$defaults = array(
CURLOPT_URL => $url . (strpos($url, ‘?‘) === FALSE ? ‘?‘ : ‘‘) . http_build_query($get),
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 15,
CURLOPT_SSLVERSION => 1,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 2
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
$result = curl_exec($ch);
if ($result === false)
{
Yii::log("GET ERROR:" . curl_error($ch));
}
curl_close($ch);
return $result;
}
标签:init 选项 strpos out ini err 数据 ret str
原文地址:https://www.cnblogs.com/gramblog/p/9876860.html