以get/post方式访问url地址并获得响应结果
@param $url
@param null $postFields
@return mixed
436143
protected function curl_access_token($url, $postFields = NULL)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_TIMEOUT, 3);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FAILONERROR, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        //https 请求
        if (strlen($url) > 5 && strtolower(substr($url, 0, 5)) == 'https') {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        }

        if (is_array($postFields) && 0 < count($postFields)) {
            $postBodyString = '';
            $postMultipart = FALSE;
            foreach ($postFields as $k => $v) {
                if ('@' != substr($v, 0, 1)) //判断是不是文件上传
                {
                    $postBodyString .= "$k=" . urlencode($v) . "&";
                } else {
                    //文件上传用multipart/form-data，否则用www-form-urlencoded
                    $postMultipart = TRUE;
                }
            }
            $postFields = trim($postBodyString, '&');
            unset($k, $v);
            curl_setopt($ch, CURLOPT_POST, TRUE);
            if ($postMultipart) {
                curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
            } else {
                curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
            }
        }

        $reponse = curl_exec($ch);
        curl_close($ch);
        return $reponse;
    }
124173
public function get($uri, $fields = array())
    {
        $fields_string = '';
        foreach ($fields as $key => $value) {
            $fields_string .= $key . '=' . $value . '&';
        }
        rtrim($fields_string, '&');
        $url = $this->getURI($uri) . '?' . $fields_string;
        return get($url, $this->getAuth());
    }
661411
protected function get_url( $url, $params ) {
		if ( empty( $params ) ) {
			return $url;
		}
		$q = strpos( $url, '?' ) !== false ? '&' : '?';

		return $url . $q . http_build_query( $params );
	}
8680
public function post($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'POST', $params, $options);
	}
977409
public static  function parsePostJson($url = '', $param = '')
    {
        if (empty($url) || empty($param)) {
            return false;
        }
        $postUrl = $url;
        $curlPost = $param;
        $ch = curl_init(); //初始化curl
        curl_setopt($ch, CURLOPT_URL, $postUrl); //抓取指定网页
        curl_setopt($ch, CURLOPT_HEADER, 0); //设置header
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上
        curl_setopt($ch, CURLOPT_POST, 1); //post提交方式
        curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
        $data = curl_exec($ch); //运行curl
        curl_close($ch);
        return json_decode($data, TRUE);
    }
894484
public static function getRelativeUrl($url = null) {
        $url = is_null($url) ? '/'.ltrim($_SERVER['REQUEST_URI'], '/') : $url;
        $rootUrlPath	= parse_url(ROOT_URL, PHP_URL_PATH);
        $absPath		= parse_url($url, PHP_URL_PATH);
        if (substr($absPath, 0, strlen($rootUrlPath)) != $rootUrlPath ) {
            throw new ResolverException('Request Uri '.$url.' outside of TAO path '.ROOT_URL);
        }
        if ($absPath === $rootUrlPath) {
            $result = '';
        } else {
            $result = substr($absPath, strlen($rootUrlPath));
        }
        return $result;
    }
607170
public function get($fields = null)
    {
        if (!empty($fields)) {
            $this->fields($fields);
        }

        return $this->httpGetRequest($this->buildUrl());
    }
605387
public function url($field)
    {
        return (filter_var(trim($this->get($field)), FILTER_VALIDATE_URL) !== false) ?: $this->error($field,
            __FUNCTION__);
    }
1335223
public function httpPost($url, $userAgent = null, $parameters = null)
    {
        $ch = $this->commonCurlParams($url,$userAgent);
      
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
        curl_setopt($ch, CURLOPT_HEADER, false);
        
        $response = $this->execute($ch);
        return $response;
    }
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;
	}
965389
public function get($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'GET', $params, $options);
	}
763421
protected function getPost($param = null, $defaultValue = null)
    {
        if ($param === null) {
            return $this->getRequest()->getPost();
        }

        return $this->getRequest()->getPost($param, $defaultValue);
    }
5200
public function postRequest(string $url, array $requestHeaders = [], array $postFields = [], bool $returnResponseHeaders = false)
    {
        $handle = $this->createCurlHandle($url);

        if (Config::get('hpProxy')) {
            $handle->setOption(CURLOPT_PROXY, Config::get('hpProxy'));
        }

        if ($returnResponseHeaders) {
            $handle->setOption(CURLOPT_HEADER, true);
        }

        if (!empty($requestHeaders)) {
            $handle->setOption(CURLOPT_HTTPHEADER, $this->prepareHeaders($requestHeaders));
        }

        if (!empty($postFields)) {
            $handle->setOption(CURLOPT_POST, true);
            $handle->setOption(CURLOPT_POSTFIELDS, http_build_query($postFields));
        }

        $response = $handle->execute();

        $statusCode = $handle->getInfo(CURLINFO_HTTP_CODE);
        $handle->close();

        if ($response && $returnResponseHeaders) {
            return $this->splitResponseHeaderAndBody($response, $statusCode);
        }

        return $response;
    }
1027074
public function getUrl($url)
    {
        if (is_array($url) && ! empty($url['route'])) {
            try {
                $Comet = \CometPHP\Comet::getInstance();
            } catch (\CometPHP\Exceptions\CometNotBooted $e) {
                return null;
            }

            $routeName = $url['route'];
            unset($url['route']);

            $generatedUrl = $Comet['routeGenerator']->generate(
                $routeName,
                $url
            );

            return $generatedUrl;
        }

        return $url;
    }
599566
function http($url, $method, $postfields = NULL) {
    $this->http_info = array();
    $ci = curl_init();
    /* Curl settings */
    curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
    curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
    curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
    curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
    curl_setopt($ci, CURLOPT_HEADER, FALSE);

    switch ($method) {
      case 'POST':
        curl_setopt($ci, CURLOPT_POST, TRUE);
        if (!empty($postfields)) {
          curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
        }
        break;
      case 'DELETE':
        curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
        if (!empty($postfields)) {
          $url = "{$url}?{$postfields}";
        }
    }

    curl_setopt($ci, CURLOPT_URL, $url);
    $response = curl_exec($ci);
    $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
    $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
    $this->url = $url;
    curl_close ($ci);
    return $response;
  }
442095
public function curlPost($url, $postfields, array $headers = array() )
    {
        $ci = curl_init();
        /* Curl settings */
        curl_setopt( $ci, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
        curl_setopt( $ci, CURLOPT_CONNECTTIMEOUT, 30 );
        curl_setopt( $ci, CURLOPT_TIMEOUT, 30 );
        curl_setopt( $ci, CURLOPT_RETURNTRANSFER, true );
        curl_setopt( $ci, CURLOPT_ENCODING, 'gzip' );
        curl_setopt( $ci, CURLOPT_FOLLOWLOCATION, true );
        curl_setopt( $ci, CURLOPT_MAXREDIRS, 5 );
        curl_setopt( $ci, CURLOPT_SSL_VERIFYPEER, false );
        curl_setopt( $ci, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt( $ci, CURLOPT_HEADER, false );

        curl_setopt( $ci, CURLOPT_POST, true );
        if ( !empty( $postfields ) ){
            curl_setopt( $ci, CURLOPT_POSTFIELDS, ( $postfields ) );
        }

        curl_setopt($ci, CURLOPT_URL, $url );
        curl_setopt($ci, CURLOPT_HTTPHEADER, $headers );
        curl_setopt($ci, CURLINFO_HEADER_OUT, true );
        $response = curl_exec( $ci );
        if($response === false){
            $error = curl_error($ci);
            echo "curl错误信息:$error\n";
        }
        curl_close ($ci);

        return $response;
    }
720353
public function httpPostRequest($url, $parameters)
    {
        if (empty($this->client)) {
            $this->client = new Client(['verify' => false]);
        }

        $this->response = $this->client->request(
            'POST',
            $url,
            [
                'headers' => $this->getHeaders(),
                'json' => $parameters
            ]
        );
        $response = json_decode($this->response->getBody());

        return $response;
    }