curl请求 $field不为空时为post请求
@param $url 请求地址
@param array $fields post数据
@return mixed|string 返回数据
775792
public function curl($url, $fields = []){
        $ch = curl_init(); //curl初始化
        curl_setopt($ch,CURLOPT_URL,$url); //设置请求地址
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//数据返回后不要直接显示
        //禁止证书校验
        curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
        curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
        if($fields){
            curl_setopt($ch,CURLOPT_TIMEOUT,30);//响应时间为30秒
            curl_setopt($ch,CURLOPT_POST,1);//设为post请求
            curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);//post数据
        }
        $data = '';
        if(curl_exec($ch)){
            if(curl_errno($ch)){
                echo 'Curl error: ' . curl_error($ch);
                exit;
            }
            //发送成功，获取数据
            $data = curl_multi_getcontent($ch);
        }
        curl_close($ch);
        $curlData = json_decode($data,true);
        if(is_array($curlData)){
            return $curlData;
        }else{
            return $data;
        }
    }
605387
public function url($field)
    {
        return (filter_var(trim($this->get($field)), FILTER_VALIDATE_URL) !== false) ?: $this->error($field,
            __FUNCTION__);
    }
770821
public function multipart( $url, $postFields ) {
		$this->assertString( 'url', $url );

		if ( !isset( $this->conn ) ) {
			$this->connect();
		}

		$headers = array(
			'Content-Type' => 'multipart/form-data'
		);

		curl_setopt( $this->conn, CURLOPT_TIMEOUT, 500 );

		return $this->post( $url, $postFields, $headers );
	}
361103
private function _curl($url, $data = '', $method = 'get')
    {
        $parStr = '';
        if (is_array($data)) {
            $parStr = http_build_query($data);
        } else {
            $parStr = $data;
        }

        if (strtolower($method) == 'get') {
            $json = file_get_contents(rtrim($url, '?').'?'.$parStr);
        } else {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $parStr);
            $json = curl_exec($ch);
            curl_close($ch);
        }

        $result = json_decode($json, true);

        if (isset($result['errcode']) and $result['errcode'] != 0) {
            $this->_log("Error-{$method}-{$url}", $json, $data);
            return false;
        }

        return $result;
    }
583877
private function _httpPost($fields) {
        $fields_string = http_build_query($fields);
        //open connection
        $ch = curl_init();
        //set headers in array
        $headers = array(
         'Expect:',
         'Content-Type: application/x-www-form-urlencoded; charset=utf-8',
        );
        //set the url, number of POST vars, POST data
        curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch,CURLOPT_URL,$this->_getFullUrl());
        curl_setopt($ch,CURLOPT_POST,count($fields));
        curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

        //execute post
        $result = curl_exec($ch);

        //close connection
        curl_close($ch);

        return $result;
    }
1107797
protected function field(array $field)
    {
        if (!empty($field['fields'])) {
            $result = $this->fieldset($field);
        } else {
            $result = $this->element($field);
        }
        return $result;
    }
704301
public function post($url, $data) {
        foreach ($data as $key => $v) {
            if (is_array($v)) {
                foreach ($v as $k => $vv) {
                    if ($vv{0} == '@') {
                        $data[ $key ][ $k ] = new \CURLFile(substr($vv, 1));
                    }
                }
            } else if ($v{0} == '@') {
                $data[ $key ] = new \CURLFile(substr($v, 1));
            }
        }
        $options = [
            CURLOPT_URL            => $url,
            CURLOPT_POST           => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POSTFIELDS     => $data
        ];
        curl_setopt_array($this->ch, $options);
        $rst = curl_exec($this->ch);
        if ($rst === false) {
            $this->error     = curl_error($this->ch);
            $this->errorCode = '500';
            $rst             = false;
        } else {
            $code = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
            if ($code != '200') {
                $this->error     = '[' . $code . ']' . get_status_header_desc($code);
                $this->errorCode = $code;
                $rst             = false;
            }
        }

        return $rst;
    }
584252
public static function curlGet($url = '', $options = array())
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        if (!empty($options)) {
            curl_setopt_array($ch, $options);
        }
        //https请求 不验证证书和host
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
125568
public function postRequest($url, $fields = [], $ref = null, $opts = []) {
        return $this->_curl($url, $fields, $ref, $opts);
    }
510043
function curlCardUpload_img($url)
    {
        $node = 'uploadimg';

        $rest      = self::curl_get($url);
        $file_tail = explode("/", $rest['type']);

        /* 判断是不是阿里云服务器 */
        if ($rest['header']['Server'] == 'AliyunOSS') {
            $imgType      = substr($url, strrpos($url, '.') + 1);
            $file_type    = 'image/' . $imgType;
            $file_tail[1] = $imgType;
        } else {
            $file_type = $rest['type'];
        }

        $name      = 'media';
        $file_name = md5(uniqid(rand(1000, 9999))) . '.' . $file_tail[1]; // 设置上传文件名
        $imgSize   = $rest['size'];
        //1M = 1048576字节 微信允许上传的最大文件
        if ($imgSize >= 1048576) {
            $this->setError('文件过大');

            return false;
        }
        // 读取临时文件里 上传文件的信息
        $key = "name=\"{$name}\"; filename=\"{$file_name}\"\r\nContent-Type: {$file_type}\r\n";

        $param       = [];
        $param[$key] = $rest['content'];

        $res = $this->_post($node, $param, false);

        return $res;
    }
100131
public function post($url, array $fields = [], callable $callback = null)
    {
        return $this->send($url, self::POST, $fields, $callback);
    }
657561
public function parseField($fields){
        if(empty($fields)) {
            $fields    = array();
        }
        if(is_string($fields)) {
            $_fields    = explode(',',$fields);
            $fields     = array();
            foreach ($_fields as $f)
                $fields[$f] = true;
        }elseif(is_array($fields)) {
            $_fields    = $fields;
            $fields     = array();
            foreach ($_fields as $f=>$v) {
                if(is_numeric($f))
                    $fields[$v] = true;
                else
                    $fields[$f] = $v ? true : false;
            }
        }
        return $fields;
    }
488803
private function curl( $url, $count = 0, $postString = false ) {

		$ch = curl_init();

		curl_setopt( $ch, CURLOPT_URL, $url );
		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );

		if( $postString ) {

			curl_setopt( $ch,CURLOPT_POST, $count );
			curl_setopt( $ch,CURLOPT_POSTFIELDS, $postString );
		}

		$data = curl_exec( $ch );

		curl_close( $ch );

		return $data;
	}
695130
protected function _post($fields = [], $slug = '')
    {
        //Build the form data
        $data = $this->orm->uniBody->Form($fields);
        // Build a url from the slug that was passed in
        $url = $this->urlFromRoute($slug);
        // Send a post request to the API
        $response = $this->orm->uniRequest->post($url, $this->orm->headers, $data);
        // If the token has expired
        if ($response->code == 401) {
            if (isset($response->body->message)) {
                if ($response->body->message == 'Token has expired') {
                    // Authenticate again
                    $this->orm->authenticate();
                    // Try the request again
                    return $this->_post($fields, $slug);
                }
            }
            // Return the response
            return $response;
        } else {
            // Return the response
            return $response;
        }
    }
764187
public function curlGet($url, array $params = [], array $opts = [])
    {
        $params = $this->params($params);
        $queryStr = http_build_query($params);
        $opts[CURLOPT_POST] = false;
        $opts[CURLOPT_URL] = $queryStr ? "$url?$queryStr" : $url;

        return self::curl($opts);
    }
1332253
public function getField($field, $token = null)
    {
        $session = $this->app->tokens->get($token);
        return ($session && isset($session[$field]))? $session[$field] : null;
    }
837746
public function post($url, $parameters = []) {
        $this->setURL($url);
        $this->setOption(CURLOPT_POST, true);
        $this->setRequestMethod('POST');
        $this->setPostFields($parameters);
        $this->setPost(true);

        return $this->run();
    }