Create and send an Http "POST" request.

@param string            $url
@param null|string|array $params

@return \BrianFaust\Http\HttpResponse
549716
public function post(string $url, $params = null): HttpResponse
    {
        return $this->send('POST', $url, [
            $this->bodyFormat => $params,
        ]);
    }
962845
public function post($url, array $params)
    {
        $request = new Request(
            $url,
            'POST',
            'php://temp',
            ['content-type' => 'application/json']
        );

        $request->getBody()->write(json_encode($params));
        return $this->send($request);
    }
725601
public function execPOST($url, array $params = [])
    {
        $url = $this->baseUrl . $url;

        $this->addOptions([
            CURLOPT_URL => $url,
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => $params,
        ]);

        return $this->exec();
    }
1209618
public function postUrlEncoded($url, array $params)
    {
        $request = new Request(
            $url,
            'POST',
            'php://temp',
            ['content-type' => 'application/x-www-form-urlencoded']
        );

        $request->getBody()->write(http_build_query($params));
        return $this->send($request);
    }
898064
public function put($url, $parameters = [])
    {
        $httpClient = $this->client->getHttpClient();

        $response = $httpClient->put($url, $parameters);

        return $httpClient->parseResponse($response);
    }
560818
protected function request($url, $method, array $params = [])
    {
        curl_setopt($this->curl, CURLOPT_URL, $url);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, $method);
        curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, $this->connectionTimeout);

        if ($this->client !== null && $this->token !== null) {
            curl_setopt($this->curl, CURLOPT_HTTPHEADER, [
                'client: ' . $this->client,
                'token: ' . $this->token
            ]);
        } elseif ($this->apikey !== null) {
            curl_setopt($this->curl, CURLOPT_HTTPHEADER, [
                'apikey: ' . $this->apikey,
            ]);
        }

        if ($this->strictSSL === false) {
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0);
        }

        if ($method == self::METHOD_PUT || $method == self::METHOD_POST) {
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, http_build_query($params));
        }

        if (!$result = curl_exec($this->curl)) {
            $error = curl_error($this->curl);
            $errno = curl_errno($this->curl);
            throw new NetworkException($error, $errno);
        }

        $result = json_decode($result, true);

        return $result ? $result : [];
    }
965389
public function get($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'GET', $params, $options);
	}
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;
    }
1107052
protected function sendRequest($url,$param){
        $this->log("Making request to Amazon: ".$this->options['Action']);
        $response = $this->fetchURL($url,$param);
        
        while (isset($response['code']) && $response['code'] == '503' && $this->throttleStop==false){
            $this->sleep();
            $response = $this->fetchURL($url,$param);
        }
        
        $this->rawResponses[]=$response;
        return $response;
    }
1366301
public static function post($url, $params)
    {
        if (!is_array($params)) {
            $params = self::ar($params);
        }

        $query = http_build_query($params);

        /*
         * open connection.
         */
        $ch = curl_init();

        /*
         * set the url, number of POST vars, POST data.
         */
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, count($params));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);

        /*
         * execute post.
         */
        $r = curl_exec( $ch );

        /*
         * close connection.
         */
        curl_close($ch);

        return $r;
    }
236431
public function makeRequest($url, $params)
    {
        $http = new HttpClient('https://api.github.com');
        $res = $http->get($url, $params);

        return $res['body'];
    }
920792
protected function curl($url, array $params = array())
    {
        // Not using array_merge here because that function reindexes numeric keys
        $options = $params + $this->config['curl'] + array(
            CURLOPT_USERAGENT => $this->userAgent,
            CURLOPT_ENCODING => '',
            CURLOPT_FOLLOWLOCATION => true,
        );

        $options[CURLOPT_URL] = $url;
        $options[CURLOPT_HEADER] = true;
        $options[CURLOPT_RETURNTRANSFER] = 1;

         // CURLOPT_FOLLOWLOCATION doesnt play well with open_basedir/safe_mode
        if (ini_get('safe_mode') || ini_get('open_basedir')) {
            $options[CURLOPT_FOLLOWLOCATION] = false;
            $options[CURLOPT_TIMEOUT] = 15;
            $this->config['force_redirects'] = true;
        }

        $handler = curl_init();
        curl_setopt_array($handler, $options);
        $response = curl_exec($handler);

        $status = curl_getinfo($handler, CURLINFO_HTTP_CODE);
        $headerSize = curl_getinfo($handler, CURLINFO_HEADER_SIZE);

        $header = substr($response, 0, $headerSize);
        $body = substr($response, $headerSize);
        curl_close($handler);

        if ($this->config['force_redirects'] && in_array($status, array('301', '302'))) {

            if (preg_match('~(?:location|uri): ?([^\n]+)~i', $header, $matches)) {

                $url = trim($matches['1']);

                // Relative redirections
                if (substr($url, 0, 1) == '/') {
                    $parsed = parse_url($options[CURLOPT_URL]);
                    $url = $parsed['scheme'] . '://' . rtrim($parsed['host'], '/') . $url;
                }

                return $this->curl($url, $options);
            }
        }

        if (empty($body) || !in_array($status, array('200'))) {
            throw new \Exception($status . ': Invalid response for ' . $url);
        }

        return $body;
    }
715430
protected function post($url, $params, $parse = true){
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_URL, $url);
		curl_setopt($curl, CURLOPT_POST, 1);
//		curl_setopt($curl, CURLOPT_POSTFIELDS, urldecode(http_build_query($params)));
//		curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
		curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
		$result = curl_exec($curl);
		curl_close($curl);
		if($parse){
			$result = json_decode($result, true);
			}
		return $result;
		}
752645
public function post($params) {
		$curl = curl_init();
		$header[] = "Content-Type: application/x-www-form-urlencoded";
		$header[] = "key: $this->api_key";
		$query = http_build_query($params);
		curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
		curl_setopt($curl, CURLOPT_URL, $this->api_url . "/" . $this->endpoint);
		curl_setopt($curl, CURLOPT_POST, TRUE);
		curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
		$request = curl_exec($curl);
		$return = ($request === FALSE) ? curl_error($curl) : $request;
		curl_close($curl);
		return $return;
	}
819934
public function delete(string $url, array $params = []): HttpResponse
    {
        return $this->send('DELETE', $url, [
            $this->bodyFormat => $params,
        ]);
    }
1149268
public function post($uri, array $params = array())
    {

        $ch = $this->initCurlHandler($uri);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

        return $this->makeRequest($ch);

    }
135775
private function apiGet($url, $params)
    {
        $url = $url . (strpos($url, '?') === false ? '?' : '') . http_build_query($params);

        try {
            $response = $this->httpClient->request('GET', $url, [
                'headers' => [
                    'user-key' => $this->igdbKey,
                    'Accept' => 'application/json'
                ]
            ]);
        } catch (RequestException $exception) {
            if ($response = $exception->getResponse()) {
                throw new \Exception($exception);
            }
            throw new \Exception($exception);
        } catch (Exception $exception) {
            throw new \Exception($exception);
        }

        return $response->getBody();
    }