Executes a POST request to Pinterest API.

@param string $resourceUrl
@param array $requestOptions
@param bool $returnData
@return bool|array
962792
public function post($resourceUrl, array $requestOptions = [], $returnData = false)
    {
        $postString = $this->request->createQuery($requestOptions);

        // When executing POST request we need a csrf-token.
        $this->initTokenIfRequired();

        $this->execute($resourceUrl, $postString);

        return $returnData ? $this->response->getResponseData() : $this->response->isOk();
    }
592735
public function request($resourceUrl, array $params = array())
    {
        $params = array('url' => $resourceUrl) + $params;

        $url = $this->setUrlParams($this->endpoint, $params);

        $data = $this->fetchUrl($url);

        if (self::TYPE_JSON === $this->type) {
            return $this->createResponseFromJson($data);
        } else if (self::TYPE_XML === $this->type) {
            return $this->createResponseFromXml($data);
        }
    }
974154
private function _executeCurl($url, $requestMethod, $key, $params = null)
    {
        $ch = curl_init($url);

        curl_setopt_array($ch, $this->genOptions($requestMethod, $key.':', $params));

        // Make a request or thrown an exception.
        if (($result = curl_exec($ch)) === false) {
            $error = curl_error($ch);
            curl_close($ch);

            throw new Exception($error);
        }

        // Close.
        curl_close($ch);

        return $result;
    }
224412
protected function buildUrl($requestUrl, $requestParams = [])
    {
        if (!empty($requestParams)) {
            $requestUrl = $requestUrl . '?' . http_build_query($requestParams);
        }

        return $requestUrl;
    }
342460
public function post($resource, $data = [])
    {
        $exec = $this->execute(Method::$HTTP_POST, $resource, ['json' => $data]);

        return $exec;
    }
671450
public function createUrlListForm(
        URLListData $data = null,
        ?string $name = null,
        array $options = []
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(SearchData::class);

        return $this->formFactory->createNamed($name, URLListType::class, $data, $options);
    }
1094871
public function post($uri, $content, $requestHeaders = array()) {
        try {
            return $this->executePost($uri, $content, $requestHeaders);
        } catch (Unauthenticated $e) {
            $this->auth_token->reset();
            return $this->executePost($uri, $content, $requestHeaders);
        }
    }
2888
protected function postRequest($uri, $body = null, $options = array())
    {
        if ($this->testMode) {
            $options['debug'] = true;
        }

        $headers = array(
            'Content-Type'               => 'application/json',
            'Accept'                     => 'application/json',
            'X-Verkkomaksut-Api-Version' => $this->apiVersion,
        );

        $options = array_merge(
            array(
                'auth'            => array($this->_apiKey, $this->_apiSecret),
                'timeout'         => 30,
                'connect_timeout' => 10,
            ),
            $options
        );

        $request = new Request('POST', $uri, $headers, $body);

        return $this->_client->send($request, $options);
    }
1363020
public function doRequest($url, $postFields = null, $curlOptions = [])
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FAILONERROR, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        if ($this->readTimeout)
        {
            curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->readTimeout);
        }
        if ($this->connectTimeout)
        {
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
        }

        if (stripos($url, 'https') === 0) //https请求
        {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        }

        if ($postFields)
        {
            if (!isset($curlOptions[CURLOPT_HTTPHEADER]))
            {
                $header = array('content-type: application/x-www-form-urlencoded; charset=UTF-8');
                curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
                if (is_array($postFields))
                {
                    $postFields = http_build_query($postFields, '', '&');
                }
            }
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
        }

        if ($curlOptions && is_array($curlOptions))
        {
            curl_setopt_array($ch, $curlOptions);
        }

        $reponse = curl_exec($ch);

        if (curl_errno($ch))
        {
            throw new Exception(curl_error($ch), 0);
        }
        else
        {
            $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            if (200 !== $httpStatusCode)
            {
                throw new Exception($reponse, $httpStatusCode);
            }
        }
        curl_close($ch);

        return $reponse;
    }
751063
public function _createHttpRequest($apiMethod, array $params = [], $requestMethod = "POST")
    {
        $apiUrl = $this->baseUrl . $apiMethod;
        $client     = new Client();

        if ($requestMethod == "POST")
        {
            $client->requestConfig = ['format' => Client::FORMAT_JSON];
        }

        $request    = $client
            ->createRequest()
            ->setUrl($apiUrl)
            ->setMethod($requestMethod)
            ->addHeaders(['Authorization' => "Token " . $this->authorization_token])
            ->addHeaders(['Accept' => 'application/json'])
            ->setData($params)
            ->setOptions([
                'timeout' => $this->timeout
            ])
        ;

        if ($requestMethod == "POST")
        {
            return $request->addHeaders(['Content-type' => 'application/json']);

        } else if ($requestMethod == "GET")
        {
            return $request;
        }

        throw new \InvalidArgumentException("Method {$requestMethod} not allow");
    }
981936
public function call($url, TransferInterface $object, $requestOptions = null): TransferInterface
    {
        return $this->zedRequestClient->call($url, $object, $requestOptions);
    }
106941
public function execute($url = null, $postData = null)
    {
        if (!is_null($url)) {
            $this->setUrl($url);
        }
        if (!is_null($postData)) {
            $this->setPostData($postData);
        }

        $this->curl_execute();

        if ($this->_errorCode) {
            return false;
        } else if (!$this->isHttpOK()) {
            $this->_errorMessage = $this->getContent();
            return false;
        } else {
            return true;
        }
    }
724942
public function request(string $url, array $requestHeaders = [], $returnResponseHeaders = false)
    {
        $handle = $this->createCurlHandle($url);

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

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

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

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

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

        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;
    }
322768
public static function doPost($url, $post_data = [], $timeout = 5, $header = "", $data_type = "")
    {
        if (empty($url) || empty($post_data) || empty($timeout))
            return false;
        if (!preg_match('/^(http|https)/is', $url))
            $url = "http://" . $url;
        $code = self::getSupport();
        switch ($code) {
            case 1:
                return self::curlPost($url, $post_data, $timeout, $header, $data_type);
                break;
            case 2:
                return self::socketPost($url, $post_data, $timeout, $header, $data_type);
                break;
            case 3:
                return self::phpPost($url, $post_data, $timeout, $header, $data_type);
                break;
            default:
                return false;
        }
    }
401798
public function post($url, $params = array(), $headers = array(), $options = array(), $fopen = false)
    {
        return $this->request('POST', $url, $params, $headers, $options, $fopen);
    }
291744
protected function callApi($queryString, $postData = null)
    {
        $this->setPostData($postData);

        $url = $this->apiUrl . '?' . $queryString . '&format=php';

        curl_setopt($this->curl, CURLOPT_URL, $url);

        $response = curl_exec($this->curl);
        $responseCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);

        if (200 !== $responseCode) {
            throw new BuildException('Wiki webapi call failed (http response ' . $responseCode . ')');
        }

        $result = @unserialize($response);
        if (false === $result) {
            throw new BuildException('Couldn\'t unserialize Wiki webapi response');
        }

        return $result;
    }