Send request to $_url

@param type $_url
@param array $_params
@return type
495387
public static function sendCurl($_url, $_params)
    {
        $Curl                 = curl_init();
        $_params[CURLOPT_URL] = $_url;
        curl_setopt_array($Curl, $_params);

        $CurlOutput = curl_exec($Curl);

        if (curl_errno($Curl)) {
            echo("Remote service error: ".curl_error($Curl).".");
        }

        curl_close($Curl);

        return $CurlOutput;
    }
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();
    }
1144623
public function query($url = '', $argsOrParams = array(), $params = array())
    {
        if (strpos($url, '%s') === false) {
            $argsOrParams = $argsOrParams + $this->request->getQueries();
        } else {
            $params += $this->request->getQueries();
        }
        return $this->__invoke($url, $argsOrParams, $params);
    }
397146
static function CallRest($p_url, $p_params = null, $p_data = null){
        $result = null;
        $url = $p_url;

        $params_attempt = new stdClass();
        $params_attempt->method = 'GET';
        $params_attempt->dataTypeRest = 'json';
        $params_attempt->debug = false;

        try {
            $params = (object) array_merge((array) $params_attempt, (array) $p_params);

            if($params->debug){
                echo('$p_url :');
                var_dump($p_url);
                echo('$params :');
                var_dump($params);
                echo('$p_data :');
                var_dump($p_data);
            }

            $curl = curl_init();

            switch ($params->method)
            {
                case "POST":
                    curl_setopt($curl, CURLOPT_POST, 1);

                    if ($p_data != null)
                        curl_setopt($curl, CURLOPT_POSTFIELDS, $p_data);
                    break;
                case "PUT":
                    curl_setopt($curl, CURLOPT_PUT, 1);
                    break;
                default:
                    if ($p_data != null)
                        $url = sprintf("%s?%s", $url, http_build_query($p_data));
            }

            // Optional Authentication:
            curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
            curl_setopt($curl, CURLOPT_USERPWD, "username:password");

            curl_setopt($curl, CURLOPT_URL, $url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

            $retourCall = curl_exec($curl);

            curl_close($curl);

            switch ($params->dataTypeRest)
            {
                case "json":
                    $result = json_decode($retourCall);
                    break;
                default:
                    $result = $retourCall;
            }

            if($result == null){
                $result = $retourCall;
            }

            if($params->debug){
                echo('$result :');
                var_dump($result);
            }

            return $result;
        } catch (Exception $e) {
            $msg = $e->getMessage();
            Throw new \Exception('Erreur dans '.__CLASS__.' : '.$msg);
            return null;
        }
    }
1364271
public function sendFile($params, $type, $multipart = false)
    {
        return $this->sendRequest('send'.ucfirst($type), $params, $multipart);
    }
1187826
protected function postRequest($url, $parameters = [])
    {
        if (!empty($parameters)) {
            $this->parameters->addPost($parameters);
        }

        return $this->request($url);
    }
35898
protected function executeRequest($url, $curl_params = array())
    {
        $defaultParams = array(
            CURLOPT_HEADER => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLINFO_HEADER_OUT => true,
            CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
            CURLOPT_USERPWD => $this->key.':',
            CURLOPT_HTTPHEADER => array( 'Expect:' ),
            CURLOPT_SSL_VERIFYPEER => config('app.env') === 'local' ? 0 : 1,
            CURLOPT_SSL_VERIFYHOST => config('app.env') === 'local' ? 0 : 2 // value 1 is not accepted https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html
        );

        $curl_options = array();
        foreach ($defaultParams as $defkey => $defval) {
            if (isset($curl_params[$defkey])) {
                $curl_options[$defkey] = $curl_params[$defkey];
            } else {
                $curl_options[$defkey] = $defaultParams[$defkey];
            }
        }
        foreach ($curl_params as $defkey => $defval) {
            if (!isset($curl_options[$defkey])) {
                $curl_options[$defkey] = $curl_params[$defkey];
            }
        }

        list($response, $info, $error) = $this->executeCurl($url, $curl_options);

        $status_code = $info['http_code'];
        if ($status_code === 0 || $error) {
            throw new PrestashopWebServiceException('CURL Error: '.$error);
        }

        $index = $info['header_size'];
        if ($index === false && $curl_params[CURLOPT_CUSTOMREQUEST] !== 'HEAD') {
            throw new PrestashopWebServiceException('Bad HTTP response');
        }

        $header = substr($response, 0, $index);
        $body = substr($response, $index);

        $headerArray = array();
        foreach (explode("\n", $header) as $headerItem) {
            $tmp = explode(':', $headerItem, 2);
            if (count($tmp) === 2) {
                $tmp = array_map('trim', $tmp);
                $headerArray[$tmp[0]] = $tmp[1];
            }
        }

        if (array_key_exists('PSWS-Version', $headerArray)) {
            $this->isPrestashopVersionSupported($headerArray['PSWS-Version']);
            $this->version = $headerArray['PSWS-Version'];
        }

        $this->printDebug('HTTP REQUEST HEADER', $info['request_header']);
        $this->printDebug('HTTP RESPONSE HEADER', $header);

        if ($curl_params[CURLOPT_CUSTOMREQUEST] == 'PUT' || $curl_params[CURLOPT_CUSTOMREQUEST] == 'POST') {
            $this->printDebug('XML SENT', urldecode($curl_params[CURLOPT_POSTFIELDS]));
        }
        if ($curl_params[CURLOPT_CUSTOMREQUEST] != 'DELETE' && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD') {
            $this->printDebug('RETURN HTTP BODY', $body);
        }

        return array(
            'status_code' => $status_code,
            'response' => $body,
            'header' => $header,
            'headers' => $headerArray
            );
    }
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);
    }
535134
public function request($url, array $params = array())
    {
        if (false === $provider = $this->resolver->resolve($url, $params)) {
            throw new \RuntimeException();
        }

        return $provider->request($url, $params);
    }
375417
public function sendRequest($url, $params, $method)
    {
        try{
            if (!empty($params['html'])){
                $commandName = 'GenerateFromHTML';
            }
            else if (!empty($params['url'])){
                $commandName = 'GenerateFromURL';
            }
            else if (!empty($params['file'])&& $url=='pdf'){
                $commandName = 'GenerateFromFile';
            }
            else {
                $operations = $this->getDescription()->getOperations();
                foreach ($operations as $operation)
                {
                    if ($operation->getUri()==$url && $operation->getHttpMethod() == $method)
                    {
                        $commandName = $operation->getName();
                    }
                }
            }
            $command = $this->getCommand($commandName, $params);
            $ret = $this->execute($command);

            if ( $commandName == 'GetAssetList' || $commandName == 'UploadAsset' )
            {
                return json_encode($ret);
            }
            return $ret->getBody(true);

        }catch(ClientErrorResponseException $exception){
            throw new \Exception($exception->getResponse()->getBody(true), $exception->getResponse()->getStatusCode());
        }
    }
553286
function requestWithoutWaiting($url, array $params = array())
    {
        $post = array();

        foreach($params as $index => $val)
        {
            $post[] = $index . '=' . urlencode($val);
        }

        $post = implode('&', $post);

        $request = parse_url($url);

        // SUPPORT FOR RELATIVE GENERATOR URL
        if(!isset($request['host']))
        {
            $request['host'] = $_SERVER['HTTP_HOST'];
        }

        if(!isset($request['port']))
        {
            $request['port'] = $_SERVER['SERVER_PORT'];
        }

        // SEND REQUEST WITHOUT WAITING
        $protocol = isset($_SERVER['HTTPS']) ? 'ssl://' : '';
        $safePort = isset($_SERVER['HTTPS']) ? 443 : 80;

        // HTTPS WORKAROUND
        if($request['port'] == 80 && $safePort == 443)
        {
            $request['port'] = $safePort;
        }

        $fp = fsockopen($protocol . $request['host'], $request['port'], $errNo, $errStr, 60);

        $command  = "POST " . $request['path'] . " HTTP/1.1\r\n";
        $command .= "Host: " . $request['host'] . "\r\n";
        $command .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $command .= "Content-Length: " . strlen($post) . "\r\n";
        $command .= "Connection: Close\r\n\r\n";

        if($post)
        {
            $command .= $post;
        }

        fwrite($fp, $command);
        fclose($fp);
    }
656283
function sendRequest()
  {
    // if this is a retry and a query parameter should be appended to the url on
    // retry, update the url
    if ((numRetries > 0) && appendQueryParamOnRetry)
    {
      options.url = Util.url.appendParam(urlOrig, 'retry', true);
    }

    sf.request(options);
  }
893485
public function send($type, $params) {
		if (empty($params['t']) && $type !== null) {
			$params['t'] = $type;
		}
		$params = $this->_appendDefaultParameters($params);
		$this->_client->setParameterPost($params);
		
		return $this->_client->request('POST', $params);
	}
281354
function _sendRequest(method, uri, options, callback) {

        method(uri, options)
            .on('success', function(data, response) {
                if (data.result) {
                    callback(null, data.result);
                } else {
                    callback(null, data);
                }
            })
            .on('fail', function(err, response) {
                if (err) {
                    callback(err);
                } else {
                    callback(new Error('Request failed'));
                }
            })
            .on('error', function(err, response) {
                if (err) {
                    callback(err);
                } else {
                    callback(new Error('Request error'));
                }
            })
            .on('timeout', function(ms) {
                callback(new Error('Request timed out (' + ms + ')'));
            });
    }
545037
public function request($url, array $params = array())
    {
        $links = self::discoverLinks($url, $params);

        $uri = new Psr7\Uri($links[0][0]);

        return new Psr7\Request('get', $uri);
    }
804874
function Post($uri, $query_params = '') {
      $uri = $this->makeUri($uri);

      if (is_array($query_params)) {
        $postArray = array();
        reset($query_params);
        while (list($k, $v) = each($query_params)) {
          $postArray[] = urlencode($k) . '=' . urlencode($v);
        }

        $this->requestBody = implode('&', $postArray);
      }

// set the content type for post parameters
      $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');

      if ($this->sendCommand('POST ' . $uri . ' HTTP/' . $this->protocolVersion)) {
        $this->processReply();
      }

      $this->removeHeader('Content-Type');
      $this->removeHeader('Content-Length');
      $this->requestBody = '';

      return $this->reply;
    }
881053
def post(url, params)
      params = convert_hash_keys(params)
      preform(url, :post, params: params) do
        return connection.post(url, params)
      end
    end