POST提交获取Array结果
@param array $data 需要提交的数据
@param string $url
@param string $method
@return array
328416
public function getArrayResult($data, $url, $method = 'postXml')
    {
        return Tools::xml2arr($this->$method($data, $url));
    }
1243683
public function post($url, $data = [], $params = null)
    {
        foreach ($data as $val) {
            if ($val instanceof UploadFile) {
                $params['contentType'] = 'multipart/form-data';
            }
        }
        if (!isset($params['contentType'])) {
            $params['contentType'] = 'application/x-www-form-urlencoded';
        }
        if ($params['contentType'] === 'application/x-www-form-urlencoded') {
            $body = http_build_query($data, '', '&', PHP_QUERY_RFC3986);
        } elseif ($params['contentType'] === 'application/x-json' || $params['contentType'] === 'application/json') {
            $body = json_encode($data);
        } else {
            $body = 'Unsupported Content-Type';
        }
        if (!isset($params['headers'])) {
            $params['headers'] = [];
        }
        $params['headers']['Content-Length'] = mb_orig_strlen($body);
        $this->sendRequestHeaders('POST', $url, $params);
        $this->write($body);
        $this->writeln('');
    }
1338481
public function post($url, $data = [], $encode = false) {

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_URL, $url);

        if (!empty($data)) {
            if (is_array($data) && $encode === true) {
                $data = http_build_query($data);
            }
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        }

        $this->_parse_result($ch);

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

        if ($this->handle_referer) {
            $this->referer = $url;
        }

        return $this->_parse_result($content);
    }
753735
public function post($url, $data = array(), $dataType = null)
    {
        return $this->processMethod($url, $data, $dataType, 'POST');
    }
67230
public function post($url, $data)
	{
		$this->init($url);
		$this->setPost($data);
		$this->exec();
		$this->fin();
	}
1300472
public function request( $method, $url, $params=null )
    {
        if( $params === null )
            $params = array();

        list( $rbody, $rcode ) = $this->requestRaw( $method, $url, $params );

        $resp = $this->interpretResponse( $rbody, $rcode, $method );

        return $resp['data'];
    }
793112
public function execute($method, $url, array $data = [])
    {
        $client = new Client(['handler' => $this->handler]);

        return json_decode($client->request($method, $url, array_merge($data, self::$OPTIONS))->getBody());
    }
1256833
public function request($method, $url, array $data = array(), array $extra = array())
    {
        switch (strtoupper($method)) {
            case 'POST':
                return $this->post($url, $data, $extra);
            case 'GET':
                return $this->get($url, $data, $extra);
            case 'PATCH':
                return $this->patch($url, $data, $extra);
            case 'HEAD':
                return $this->head($url, $data, $extra);
            case 'PUT':
                return $this->put($url, $data, $extra);
            case 'DELETE':
                return $this->delete($url, $data, $extra);
            default:
                throw new UnexpectedValueException(sprintf('Unsupported or unknown HTTP method provided "%s"', $method));
        }
    }
516590
protected function httpRequest($method, $data)
    {
        $url  = $this->getEndpoint($method);
        $body = http_build_query($data);

        $headers = [
            'Content-Type' => 'application/x-www-form-urlencoded'
        ];

        $response = $this->httpClient->request('POST', $url, $headers, $body)->getBody();

        $payload  = StringUtil::parseFuckStr($response);

        return $payload;
    }
1169358
public static function run($url = null, $data = null, $method = 'GET') {
        if ($url) {
            if (is_string($data)) {
                $method = $data;
                $data   = null;
            }
            $method                 = strtoupper($method);
            $_SERVER['REQUEST_URI'] = $url;
            $query                  = @parse_url($url, PHP_URL_QUERY);
            if ($query) {
                $args = [];
                parse_str($query, $args);
                if ($args) {
                    if ($data) {
                        $data = array_merge($data, $args);
                    } else {
                        $data = $args;
                    }
                }
            }
            $_SERVER['REQUEST_METHOD'] = $method;
            if ($data) {
                if ($method == 'GET') {
                    $_SERVER['QUERY_STRING'] = http_build_query($data);
                }
                Request::getInstance()->addUserData($data);
            }

            $_SERVER['REQUEST_TIME'] = time();
        }
        if (!isset ($_SERVER ['REQUEST_URI'])) {
            Response::respond(500, 'Your web server did not provide REQUEST_URI, stop route request.');
        }

        if (!self::$app->router) {
            self::$app->router = Router::getRouter();
        }
        try {
            return self::$app->router->route();
        } catch (\Exception $e) {
            if (defined('DEBUG') && DEBUG < DEBUG_ERROR) {
                show_exception_page($e);
            } else {
                Response::respond(500, $e->getMessage());
            }
        }

        return false;
    }
577230
private function _curl($url, $data = '', $method = 'get')
    {
        if (is_array($data)) {
            $parStr = http_build_query($data);
        } else {
            $parStr = $data;
        }

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

        //除get请求外默认为post
        if (strtolower($method) == 'get') {
            curl_setopt($ch, CURLOPT_URL, rtrim($url, '?') . '?' . $parStr);
        } else {
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $parStr);
        }

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

        //0是头部内容1是body内容
        list($head, $body) = explode("\r\n\r\n", $content, 2);

        if (! preg_match('/\ncontent-type: ?application\/json/ism', $head)) {
            return [
                'body' => $body,
                'head' => $head
            ];
        } else {
            $result = json_decode($body, true);

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

            return $result;
        }
    }
230531
public function call($method, array $data = null, $type = 'get')
    {
        $url = self::URL_PREFIX . '/' . $method . '?auth_token=' . $this->token;
        if ($data && $type == 'get') {
            $url .= '&' . implode('&', $data);
        }

        $options = [
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true
        ];
        if ($data && $type == 'post') {
            $options[CURLOPT_POST] = true;
            $options[CURLOPT_POSTFIELDS] = $data;
        }
        $response = self::jsonValidate($this->executeCurl($options), $this->returnArray);

        return $response['data'];
    }
111947
protected function _post($url, $data = [], $class = null) {
        $client = new HttpClient($this->patrol, 'post', $url, $data);

        $data = $client->response();

        if (isset($data['error'])) {
            $this->_error($data);
        }

        if (!isset($data['data'])) {
            return $data;
        }

        $data = $data['data'];

        $callee = $class ? $class : get_called_class();
        return Util::parseResponseToPatrolObject($this->patrol, $data, $callee, $this->defaults);
    }
236843
public function api(string $method, string $endpoint, array $data = []): array
    {
        $endpoint = '/' . ltrim($endpoint, '/'); // Ensure leading slash is present
        return $this->api->call($method, $endpoint, $data);
    }
268430
public function get($url, $data = [], $method = 'post') {

        $ch = curl_init($this->gitlab_host . '/api/v3' . $url);
       
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'PRIVATE-TOKEN:' . $this->private_key
        ));
        if($this->debug){
            curl_setopt($ch, CURLOPT_VERBOSE, true);
            if(!\sb\Gateway::$command_line){
                $curl_log = fopen("php://temp", 'rw');
                curl_setopt($ch, CURLOPT_STDERR, $curl_log);
            }
            
        }
         
       
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        
        if ($data) {
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
            if ($method != 'post') {
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
            }
        }

        $error = curl_error($ch);
        $error_no = curl_errno($ch);
      
        if ($error_no) {
            throw(new \Exception($error . ': ' . $error_no));
        }
        $data = json_decode(curl_exec($ch));
        
        if($this->debug && !\sb\Gateway::$command_line){
            rewind($curl_log);
            $output= fread($curl_log, 2048);
            echo "<pre>". print_r($output, 1). "</pre>";
            fclose($curl_log);

        }
        
        return $data;
    }
486735
private function callHttpMethod($uri, $method, array $data = [])
    {
        $request = new Request();
        $request->setUri($uri);
        if (! empty($data)) {
            switch ($method) {
                case Request::METHOD_GET:
                    $request->setQuery(new Parameters($data));
                    break;
                case Request::METHOD_POST:
                case Request::METHOD_PUT:
                case Request::METHOD_PATCH:
                    $request->setContent(json_encode($data));
                    break;
            }
        }
        $request->setMethod($method);
        $request->getHeaders()->addHeaders($this->getDefaultHeaders());
        return json_decode($this->getHttpClient()->send($request)->getBody());
    }
29670
public function post($url, array $data, array $headers = null)
    {
        $headers = is_null($headers) ? ['Content-Type: application/json; charset=utf-8'] : $headers;
        return $this->sendRequest('POST', $url, $headers, $data);
    }