单个独立GET请求协程（自动完成DNS查询、获取数据）

@param string $url 请求的URL
@param array $query GET的数据
@param int $timeout 请求超时时间
@param array $headers 额外的报头
@return Http
@throws Exception
429335
public function goSingleGet($url = '', $query = [], $timeout = 30000, $headers = [])
    {
        if (empty($this->urlData)) {
            $this->urlData = self::parseUrl($url);
        } else {
            if (!empty($url)) {
                $this->urlData['path'] = $url;
            }
        }

        yield $this->goDnsLookup();
        $this->setHeaders($headers);

        //支持直接在url之后带参数形式的GET请求
        $q = '';
        if (!empty($this->urlData['query'])) {
            $q = ltrim($this->urlData['query'], '?');
        }

        if (!empty($query)) {
            $q .= (empty($q) ? '' : '&') . http_build_query($query) ;
        }

        return yield $this->getObject(Http::class, [$this, 'GET', $this->urlData['path'], $q, $timeout]);
    }
578940
public function postForm($url, array $params = [], $timeout = null)
    {
        $body = $this->createQueryString($params);
        return $this->post($url, $body, \Zend\Http\Client::ENC_URLENCODED, $timeout);
    }
959981
private function httpGet( $path, array $query = array() ){

        $url = new Uri( $this->baseUrl . $path );

        foreach( $query as $name => $value ){
            $url = URI::withQueryValue($url, $name, $value );
        }

        //---

        $request = new Request(
            'GET',
            $url,
            $this->buildHeaders()
        );

        try {

            $response = $this->getHttpClient()->sendRequest( $request );

        } catch (\RuntimeException $e){
            throw new Exception\NotifyException( $e->getMessage(), $e->getCode(), $e );
        }

        //---

        switch( $response->getStatusCode() ){
            case 200:
                return $this->handleResponse( $response );
            case 404:
                return null;
            default:
                return $this->handleErrorResponse( $response );
        }

    }
1120115
protected function getUrl($url, $headers, $timeout): ResponseInterface
    {
        try {
            $options = $this->buildGuzzleOptions($headers, $timeout);
            $response = $this->requestFactory->request($url, 'GET', $options);
        } catch (ClientException $e) {
            $response = $e->getResponse();
        } catch (ServerException $e) {
            $response = $e->getResponse();
        }

        return $response;
    }
1057459
public function get($api, $params = [], $timeout = null) {
        $this->prepare($params, $api);
        $url = $this->url . '?' . http_build_query($params);
        curl_setopt($this->curl, CURLOPT_URL, $url);
        curl_setopt($this->curl, CURLOPT_HTTPGET, 1);
        curl_setopt($this->curl, CURLOPT_UPLOAD, false);
        if (is_numeric($timeout) && $timeout) {
            $this->timeout = $timeout;
            curl_setopt($this->curl, CURLOPT_TIMEOUT, $timeout);
        }

        return $this;
    }
900656
public static function get( $url, $params=null, $headers=null, $return_header = false )
	{
		$self = new self();
		if ( is_array($params) ) {
			$params = http_build_query($params);
			if ( strpos($url, '?') == false ) {
				$url .= '?'.$params;
			} else {
				$url .= '&'.$params;
			}
		}

		$curl = $self->_curlInit($url, $headers);
		curl_setopt($curl, CURLOPT_HTTPGET, true);
		return $self->_doRequest($curl, $return_header);
	}
1020142
public function goSinglePost($url = '', $data = [], $timeout = 30000, $headers = [])
    {
        if (empty($data)) {
            throw new Exception('post data is empty');
        }

        if (empty($this->urlData)) {
            $this->urlData = self::parseUrl($url);
        } else {
            if (!empty($url)) {
                $this->urlData['path'] = $url;
            }
        }

        yield $this->goDnsLookup();
        $this->setHeaders($headers);

        if (!empty($this->urlData['query'])) {
            return yield $this->getObject(
                Http::class,
                [$this, 'POST', $this->urlData['path'] . $this->urlData['query'], $data, $timeout]
            );
        } else {
            return yield $this->getObject(
                Http::class,
                [$this, 'POST', $this->urlData['path'], $data, $timeout]
            );
        }
    }
159240
public static function get($url, $query = [], $options = [])
    {
        $options['query'] = $query;
        return self::doRequest('get', $url, $options);
    }
1000025
public function request(&$query)
    {
        global $_web_access_compress_reply;
        global $_web_access_post_xmlrpc;
        global $_web_access_retry_timeout;
        global $_web_access_retry_timeout_max;

        $query['State'] = 'BAD';
        $query['HDatas'] = '';
        $query['Datas'] = '';
        $query['DatasSize'] = 0;
        $query['DatasSent'] = 0;
        $query['Response'] = '';
        $query['ResponseSize'] = 0;
        $query['Headers'] = array();
        $query['Close'] = false;
        $query['Times'] = array(
            'open' => array(-1.0, -1.0),
            'send' => array(-1.0, -1.0),
            'receive' => array(-1.0, -1.0, 0),
        );


        // if async, in error, and maximal timeout, then forget the request and return false.
        if (($query['Callback'] != null) && ($this->_state == 'BAD')) {
            if ($this->_bad_timeout > $_web_access_retry_timeout_max) {
                $this->console->writeln($this->_webaccess_str.'$f00Request refused for consecutive errors $555('.$this->_bad_timeout
                    ." / ".$_web_access_retry_timeout_max.")");

                return false;
            } else {
                // if not max then accept the request
                // and try a request (minimum $_web_access_retry_timeout/2 after previous try)
                $time = time();
                $timeout = ($this->_bad_timeout / 2) - ($time - $this->_bad_time);
                if ($timeout < 0) {
                    $timeout = 0;
                }
                $this->_bad_time = $time - $this->_bad_timeout + $timeout;
            }
        }

        // build datas to send
        if (($query['Callback'] == null) || (is_array($query['Callback']) &&
                isset($query['Callback'][0]) &&
                is_callable($query['Callback'][0]))
        ) {

            if (is_string($query['QueryDatas']) && strlen($query['QueryDatas']) > 0) {
                $msg = "POST ".$query['Path']." HTTP/1.1\r\n";
                $msg .= "Host: ".$this->_host."\r\n";
                $msg .= "User-Agent: ".$this->_agent."\r\n";
                $msg .= "Cache-Control: no-cache\r\n";

                if ($_web_access_compress_reply) {
                    // ask compression of response if gzdecode() and/or gzinflate() is available
                    if (function_exists('gzdecode') && function_exists('gzinflate')) {
                        $msg .= "Accept-Encoding: deflate, gzip\r\n";
                    } elseif (function_exists('gzdecode')) {
                        $msg .= "Accept-Encoding: gzip\r\n";
                    } elseif (function_exists('gzinflate')) {
                        $msg .= "Accept-Encoding: deflate\r\n";
                    }
                }

                // echo "\nData:\n\n".$query['QueryDatas']."\n";  // for debug purposes, don't remove!

                if ($query['IsXmlrpc'] === true) {
                    if ($_web_access_post_xmlrpc) {
                        $msg .= "Content-type: application/x-www-form-urlencoded; charset=UTF-8\r\n";

                        echo "\n=========================== Data =================================\n\n".$query['Datas']."\n";

                        $query['QueryDatas'] = "xmlrpc=".urlsafe_base64_encode($query['QueryDatas']);
                    } else {
                        $msg .= "Content-type: text/xml; charset=UTF-8\r\n";
                    }

                    if ($this->_compress_request == 'gzip' && function_exists('gzencode')) {
                        $msg .= "Content-Encoding: gzip\r\n";
                        $query['QueryDatas'] = gzencode($query['QueryDatas']);
                    } elseif ($this->_compress_request == 'deflate' && function_exists('gzdeflate')) {
                        $msg .= "Content-Encoding: deflate\r\n";
                        $query['QueryDatas'] = gzdeflate($query['QueryDatas']);
                    }
                } elseif (is_string($query['IsXmlrpc'])) {
                    $msg .= "Content-type: ".$query['IsXmlrpc']."\r\n";
                    $msg .= "Accept: */*\r\n";
                } else {
                    $msg .= "Content-type: ".$query['MimeType']."\r\n";
                    $msg .= "Accept: */*\r\n";
                }

                $msg .= "Content-length: ".strlen($query['QueryDatas'])."\r\n";

                $query['HDatas'] = $msg;

                $query['State'] = 'OPEN';
                $query['Retries'] = 0;

                // print_r($msg); for debugging purposes - don't remove

                // add the query in spool
                $this->_spool[] = &$query;

                if ($query['Callback'] == null) {
                    $this->_wait = true;
                    $this->_open($query['OpenTimeout'], $query['WaitTimeout']); // wait more in not callback mode
                    $this->_spool = array();
                    $this->_wait = false;

                    return $query['Response'];
                } else {
                    $this->_open();
                }
            } else {
                $msg = "GET ".$query['Path']." HTTP/1.1\r\n";
                $msg .= "Host: ".$this->_host."\r\n";
                $msg .= "User-Agent: ".$this->_agent."\r\n";
                $msg .= "Cache-Control: no-cache\r\n";
                if ($_web_access_compress_reply) {
                    // ask compression of response if gzdecode() and/or gzinflate() is available
                    if (function_exists('gzdecode') && function_exists('gzinflate')) {
                        $msg .= "Accept-Encoding: deflate, gzip\r\n";
                    } elseif (function_exists('gzdecode')) {
                        $msg .= "Accept-Encoding: gzip\r\n";
                    } elseif (function_exists('gzinflate')) {
                        $msg .= "Accept-Encoding: deflate\r\n";
                    }
                }
                $msg .= "Content-type: ".$query['MimeType']."; charset=UTF-8\r\n";
                $msg .= "Content-length: ".strlen($query['QueryDatas'])."\r\n";
                $query['HDatas'] = $msg;

                $query['State'] = 'OPEN';
                $query['Retries'] = 0;

                // add the query in spool
                $this->_spool[] = &$query;

                if ($query['Callback'] == null) {
                    $this->_wait = true;
                    $this->_open($query['OpenTimeout'], $query['WaitTimeout']); // wait more in not callback mode
                    $this->_spool = array();
                    $this->_wait = false;

                    return $query['Response'];
                } else {
                    $this->_open();
                }
            }

        } else {

            $this->console->writeln($this->_webaccess_str.'Bad callback function:$fff '.$query['Callback']);

            return false;
        }

        return true;
    }
36716
public static String get(String url, Map<String, String> queryParas, Map<String, String> headers) {
		HttpURLConnection conn = null;
		try {
			conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), GET, headers);
			conn.connect();
			return readResponseString(conn);
		}
		catch (Exception e) {
			throw new RuntimeException(e);
		}
		finally {
			if (conn != null) {
				conn.disconnect();
			}
		}
	}
1106362
public function searchCollection($query, array $parameters = [], array $headers = [])
    {
        return $this->get('search/collection', array_merge($parameters, [
            'query' => $query
        ], $headers));
    }
1233984
public static function get($url, $query_data = null, array $headers = array(), array $options = array())
    {
        return self::request('GET', $url, $query_data, null, $headers, $options);
    }
398938
public function process($query, $format = null, $timeout = 6000, $pagination = true)
    {
        $this->timeout = $timeout;
        $factory = new RequestProcessorFactory();
        $processor = $factory->create(gettype($query));
        $request = $processor->convertToObjectRequest($query);
        $validation = $this->validate($request);
        if ($validation->count() === 0) {
            $result = $this->callApi($request, $format);
            $pagination_total_result_le_pagination_item_per_page = false;
            if (isset($result->pagination)) {
                if ($result->pagination->total_result <= $result->pagination->items_per_page) {
                    $pagination_total_result_le_pagination_item_per_page = true;
                }
            }
            if ($pagination !== false ||
                $pagination_total_result_le_pagination_item_per_page) {
                return $result;
            } else {
                return $this->deletePagination($request, $format, $result);
            }
        } else {
            return $validation;
        }
    }
240303
public function get($url, $headers = [], $options = [])
    {
        return $this->request('GET', $url, null, $headers, $options);
    }
79810
public function send($method, $uri, $body = null, array $query = [], array $headers = [], array $options = [])
    {
        $this->validateMethod($method);

        $query = array_merge($this->getDefaultQuery(), $query);
        $headers = array_merge($this->getDefaultHeaders(), $headers);

        $this->lastResponse = $this->client->send($method, $uri, $body, $query, $headers, $options);

        $this->validateResponse($this->lastResponse);

        return $this->lastResponse;
    }
852328
def get(query_url,
            headers: {})
      HttpRequest.new(HttpMethodEnum::GET,
                      query_url,
                      headers: headers)
    end
1157998
public static function getURL( $url, $headers = '' ) {
		$ch = curl_init() or die( 'curl issue' );

		curl_setopt( $ch, CURLOPT_URL, $url );
		curl_setopt( $ch, CURLOPT_POST, 0 );
		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
		curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
		curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0' );

		if ( ! empty( $headers ) ) {
			curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
		}


		$out = curl_exec( $ch );
		curl_close( $ch );

		return $out;
	}