Send the configured query or mutation with given variables

@return Response
501003
public function sendQuery(): Response
    {
        $data = [
            'query' => $this->getGraphQL(),
            'variables' => $this->getVariables(),
        ];
        if ($this->operationName) {
            $data['operationName'] = $this->operationName;
        }

        $content = json_encode($data);
        $this->insulated = $this->config['insulated'] ?? false;

        $this->sendRequest(Request::METHOD_POST, $this->getEndpoint(), $this->getRequestsParameters(), [], $this->getServerParameters(), $content);

        return $this->response = $this->getResponse();
    }
560846
public function send() {
        $curlUrl = $this->url;
        if ($this->params) {
            $queryString = http_build_query($this->params);
            $separator = parse_url($curlUrl, PHP_URL_QUERY) ? '&' : '?';
            $curlUrl .= $separator . $queryString;
        }

        // Mock the request if self::$mock exists
        if (self::$mock) {
            if (self::$mock['url'] == $curlUrl && self::$mock['method'] == $this->method) {
                return self::$mock['response'];
            }
            return null;
        }

        // Open and configure curl connection
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $curlUrl);
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
        $headers = array(
            'User-Agent: SiftScience/v' . $this->version . ' sift-php/' . Sift::VERSION
        );
        if ($this->auth) {
            curl_setopt($ch, CURLOPT_USERPWD, $this->auth);
        }

        // HTTP-method-specific configuration.
        if ($this->method == self::POST) {
            if (function_exists('json_encode')) {
                $jsonString = json_encode($this->body);
            } else {
                require_once(dirname(__FILE__) . '/Services_JSON-1.0.3/JSON.php');
                $json = new Services_JSON();
                $jsonString = $json->encodeUnsafe($this->body);
            }

            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString);
            array_push($headers, 'Content-Type: application/json',
                'Content-Length: ' . strlen($jsonString)
            );

        } else if ($this->method == self::DELETE) {
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
        }

        foreach ($this->curl_opts as $option => $value) {
            if ($option !== CURLOPT_HTTPHEADER) {
                curl_setopt($ch, $option, $value);
            } else {
                $headers = array_merge($headers, $value);
            }
        }

        // Send the request using curl and parse result
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($ch);
        $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $curlErrno = curl_errno($ch);
        $curlError = curl_error($ch);
        curl_close($ch);

        return new SiftResponse($result, $httpStatusCode, $this, $curlErrno, $curlError);
    }
305333
public function send()
	{
		$mappedParams = $this->map();

		$curler = new \GuzzleHttp\Client(['base_uri' => $this->tgUrl]);

		if (empty($this->multipart)) {
			$response = $curler->request("POST", static::$method, [
				"query" => $mappedParams
			]);
		} else {
			$response = $curler->request("POST", static::$method, [
				"query" => $mappedParams,
				"multipart" => $this->multipart
			]);
		}

		$jsonResponse = json_decode((string)$response->getBody(), true);
		$result = $jsonResponse['result'];
		return static::decodeResult($result);
	}
235459
public function prepare()
    {
        $request = parent::prepare();

        $url = $request->getUrl(true);

        $query = $url->getQuery();
        $query->merge($this->templateVariables);
        $request->setUrl($url);

        return $request;
    }
567406
public function backupRequestVariables()
    {
        $this->requestCache['_SERVER'] = $_SERVER;
        $this->requestCache['_POST'] = $_POST;
        $this->requestCache['_GET'] = $_GET;
        $this->requestCache['_SESSION'] = $_SESSION;
        $this->requestCache['_COOKIE'] = $_COOKIE;
    }
12709
public function send()
    {
        $allowed_status_codes = array_merge(array(200), $this->ignoredStatusCodes);
        $this->ignoredStatusCodes = array();

        try {
            $this->_setupCurl();
            $response = curl_exec($this->curl);

            if (!in_array(curl_getinfo($this->curl, CURLINFO_HTTP_CODE), $allowed_status_codes)) {
                if (curl_errno($this->curl)) {
                    throw new \RuntimeException('The HTTP request failed: ' . curl_error($this->curl));
                }
                throw new \RuntimeException('The HTTP request failed: unknown error.');
            }
            curl_close($this->curl);

            return $this->hasToDecodeResponse ? json_decode($response) : $response;
        } catch (Exception $e) {  }
    }
1158955
public function filterRequest( $query_vars ) {
		/** @var $routes \WPEmerge\Routing\RouteInterface[] */
		$routes = $this->router->getRoutes();

		foreach ( $routes as $route ) {
			if ( ! $route instanceof HasQueryFilterInterface ) {
				continue;
			}

			if ( ! $route->isSatisfied( $this->request ) ) {
				continue;
			}

			$query_vars = $route->applyQueryFilter( $this->request, $query_vars );
			break;
		}

		return $query_vars;
	}
980587
public function send()
    {
        // The URI has already been overriden (if applicable) by this point.
        $uri = isset($this->request->url) ? $this->request->url : null;
        if ($this->test && !empty($this->request->testUrl)) {
            $uri = $this->request->testUrl;
        }
        $uri = trim($this->renderTokens($uri));
        if (empty($uri)) {
            throw new ContactClientException(
                'No URL was specified for an API operation.',
                0,
                null,
                Stat::TYPE_ERROR,
                false
            );
        }

        $this->setLogs($uri, 'uri');

        $request   = $this->request;
        $transport = $this->transport;
        $options   = [];
        $manual    = isset($request->manual)
            && $request->manual
            && isset($request->template)
            && !empty(trim($request->template));

        // Retrieve/filter/tokenize the Request Body Field values if present.
        $requestFields = [];
        if (!$manual && !empty($request->body) && !is_string($request->body)) {
            $requestFields = $this->fieldValues($request->body);
        }
        $requestFormat = strtolower(isset($request->format) ? $request->format : 'form');
        $this->setLogs($requestFormat, 'format');
        switch ($requestFormat) {
            case 'form':
            default:
                $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
                if ($requestFields) {
                    $options['form_params'] = $requestFields;
                }
                break;

            case 'json':
                $options['headers']['Content-Type'] = 'application/json; charset=utf-8';
                if ($requestFields) {
                    $options['json'] = $requestFields;
                }
                break;

            case 'text':
                $options['headers']['Content-Type'] = 'text/plain; charset=utf-8';
                if ($requestFields) {
                    // User specified to send raw text, but used key value pairs.
                    // We will present this as YAML, since it's the most text-like response.
                    $yaml = Yaml::dump($requestFields);
                    if ($yaml) {
                        $options['body'] = $yaml;
                    }
                }
                break;

            case 'xml':
                $options['headers']['Content-Type'] = 'application/xml; charset=utf-8';
                if ($requestFields) {
                    $doc                     = new DomDocument('1.0');
                    $doc->preserveWhiteSpace = false;
                    $doc->formatOutput       = true;
                    $root                    = $doc->createElement(self::XML_ROOT_ELEM);
                    $doc->appendChild($root);
                    foreach ($requestFields as $key => $value) {
                        $element = $doc->createElement($key);
                        $element->appendChild(
                            $doc->createTextNode($value)
                        );
                        $root->appendChild($element);
                    }
                    $xml = $doc->saveXML();
                    if ($xml) {
                        $options['body'] = $xml;
                    }
                }
                break;

            case 'yaml':
                $options['headers']['Content-Type'] = 'application/x-yaml; charset=utf-8';
                if ($requestFields) {
                    $yaml = Yaml::dump($requestFields);
                    if ($yaml) {
                        $options['body'] = $yaml;
                    }
                }
                break;
        }

        // Add the manual template if provided and manual mode is enabled.
        if ($manual) {
            $templateFields = $this->templateFieldValues($request->body);
            $body           = $this->renderTokens($request->template, $templateFields);
            if (!empty(trim($body))) {
                $options['body'] = $body;
                // Prevent double-encoding JSON.
                unset($options['json']);
            }
        } else {
            if (is_string($request->body) && !empty(trim($request->body))) {
                // For backward compatibility, support body as a string.
                $body = $this->renderTokens($request->body);
                if (!empty(trim($body))) {
                    $options['body'] = $body;
                }
            }
        }

        // Header Field overrides.
        if (!empty($request->headers)) {
            $headers = $this->fieldValues($request->headers);
            if (!empty($headers)) {
                if (isset($options['headers'])) {
                    $options['headers'] = array_merge($options['headers'], $headers);
                } else {
                    $options['headers'] = $headers;
                }
            }
        }

        $method = trim(strtolower(isset($request->method) ? $request->method : 'post'));
        $this->setLogs($method, 'method');
        $startTime = microtime(true);
        switch ($method) {
            case 'delete':
                $this->setLogs($options, 'options');
                $transport->delete($uri, $options);
                break;

            case 'get':
                if ($requestFields) {
                    $options['query'] = $requestFields;
                    // GET will not typically support form params in addition.
                    unset($options['form_params']);
                }
                $this->setLogs($options, 'options');
                $transport->get($uri, $options);
                break;

            case 'head':
                $this->setLogs($options, 'options');
                $transport->head($uri, $options);
                break;

            case 'patch':
                $this->setLogs($options, 'options');
                $transport->patch($uri, $options);
                break;

            case 'post':
            default:
                $this->setLogs($options, 'options');
                $transport->post($uri, $options);
                break;

            case 'put':
                $this->setLogs($options, 'options');
                $transport->put($uri, $options);
                break;
        }
        $transportRecords = $transport->getRecords();
        if ($transportRecords) {
            $debug = [];
            foreach ($transportRecords as $transportRecord) {
                if (
                    isset($transportRecord['channel'])
                    && 'guzzle.to.curl' == $transportRecord['channel']
                    && isset($transportRecord['message'])
                ) {
                    $debug[] = $transportRecord['message'];
                }
            }
            if ($debug) {
                $this->setLogs($debug, 'debug');
            }
        }
        $this->setLogs(microtime(true) - $startTime, 'duration');
        if ($this->test) {
            $this->setLogs($this->tokenHelper->getContext(true), 'availableTokens');
        }
    }
569889
public function query()
    {
        $sourceUUID = $this->getSourceUUID();
        if (empty($sourceUUID)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Source UUID header must be defined',
            ], 400);
        }

        $authorUUID = $this
            ->userCredentialsProvider
            ->getUUID();

        $queryParameterBag = $this
            ->request
            ->query;

        $page = (int) $queryParameterBag->get('page', 1);
        $numPerPage = (int) $queryParameterBag->get('num_per_page', 10);
        $sortBy = json_decode($queryParameterBag->get(
            'sort_by',
            ['created_at' => 'desc']
        ), true);
        $indexedMetadataSortBy = [
            'indexed_metadata.' . key($sortBy) => $sortBy[key($sortBy)],
        ];

        $role = $this->userCredentialsProvider->isModerator()
            ? Author::ROLE_MODERATOR
            : Author::ROLE_USER;

        $result = $this
            ->commentRepository
            ->getCommentsBySource(
                $sourceUUID,
                $page,
                $numPerPage,
                $indexedMetadataSortBy,
                $role
            );

        if (!empty($authorUUID)) {
            foreach ($result->getComments() as $comment) {
                $this->setEditableInComment(
                    $comment,
                    $authorUUID
                );
            }
        }
        
        return new JsonResponse([
            'comments_result' => $result->toArray(),
            'user' => $this->userCredentialsProvider->toArray(),
        ], 200);
    }
857094
private function setCptQueryVars() {
        foreach ( get_post_types( [ ], 'objects' ) as $post_type => $t ) {
            if ( $t->query_var ) $this->post_type_query_vars[$t->query_var] = $post_type;
        }
    }
62648
public function send()
  {
    # Set HTTP Response Code
    http_response_code($this->statusCode);

    # Update Cache-Control Header
    if ( empty($this->getHeader('Cache-Control')) ) {
      $this->setHeader('Cache-Control', $this->cacheControl);
    }

    # Set All HTTP headers
    foreach ($this->headers as $header => $value) {
      header($header.': '.$value);
    }

    # Set all cookies
    foreach ($this->cookies as $idx => $cookie) {
      setCookie( $cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'] );
    }

    # Send Response Body -- if we have something in the $body param
    if ( !empty($this->getBody()) ) {
      echo $this->getBody();
    } else
    if ( !empty($this->getFileBody()) ) {
      readfile($this->getFileBody());
    }

    # Results
    return $this;
  }
711791
public static function send()
    {
        $format = self::getResponseFormat();
        if ($format === 'unknown') {
            return;
        }

        if (count(self::$records)) {
            if ($format === 'html') {
                self::writeOutput('<script>' . self::generateScript() . '</script>');
            } elseif ($format === 'js') {
                self::writeOutput(self::generateScript());
            }
            self::reset();
        }
    }
119481
public function passRequestData()
    {
        $this
            ->getValidator()
                ->setInputData($this
                    ->getRequest()
                        ->query
                            ->all()
                );

        $this
            ->getValidator()
                ->setInputData($this
                    ->getRequest()
                        ->request
                            ->all()
                );

        return $this;
    }
1124565
public static function Send(){
            $oThis = self::CreateInstanceIfNotExists();
            
            if(is_object($oThis->oSmarty)){
                $oThis->CreateCacheCSS();
                $oThis->CreateCacheJS();
                
                Storage::AssignSmarty($oThis->oSmarty);
                Events::Call("BeforeSendingOutput");
                
                $oThis->oSmarty->display($oThis->sTemplateFilename);
            }
            else{
                $oThis = self::CreateInstanceIfNotExists();
                $oThis->CreateCacheCSS();
                $oThis->CreateCacheJS();
                $oThis->IncludeTemplate();
                $oThis->ReplaceVars();
                $oThis->RemoveUndefinedVars();
                $oThis->CheckConditions();
                //$oThis->ClearList();
                Events::Call("BeforeSendingOutput");

                @header('HTTP/1.1 200 OK');
                @header("Content-Type: text/html; charset=" . strtoupper(Storage::Get("app.charset", "UTF-8")), true);

                try{
                    //var_dump($oThis->sBuffer); die();
                    eval('?> ' . $oThis->sBuffer);
                    die();
                }
                catch(Exception $e){
                    die($e->getMessage());
                }
            }
        }
85409
protected function send(array $query)
    {
        if (!$this->key || !$this->secret || !$this->from) {
            throw new Exception\ConfigurationException(
                "Invalid configuration. Missing key, secret, or from."
            );
        }
        
        $query["api_key"]           = $this->key;
        $query["api_secret"]        = $this->secret;
        $query["from"]              = $this->from;
        $query["status-report-req"] = $this->status_report_req;
        if ($this->ttl) {
            $query["ttl"] = $this->ttl;
        }
        
        $response = $this->guzzle->get(self::API_URI, [
            "query" => $query
        ])->json();

        /**
         * @var Message[] $messages
         * @var Exception\Exception[] $exceptions
         */
        $messages   = [];
        $exceptions = [];
        foreach($response["messages"] as $message) {
            if ($message["status"] != 0) {
                $exceptions[] = Exception\Factory::factory(
                    $message["error-text"],
                    $message["status"]
                );
            } else {
                $messages[] = new Message($message);
            }
        }
        
        $response = new Response($messages, $exceptions);
        if ($exceptions) {
            $exceptions[0]->setResponse($response);
            throw $exceptions[0];
        }
        
        return $response;
    }
1308898
public function send() {

		//Set default status
		$this -> response -> setStatus([

			'code' 		=> 0,
		    'protocol' 	=> '',
		    'status' 	=> '',
		    'text' 		=> ''
		]);

		$curl = curl_init();

		curl_setopt_array($curl, $this -> createOptions());

		$response = curl_exec($curl);

		if(false !== $response) {

			$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
			$headers 	 = substr($response, 0, $header_size);
			$headers 	 = $this -> parseHeaders($headers);
			$body 		 = substr($response, $header_size);
			$json 		 = @json_decode($body, true);

			$this -> response -> setHeaders($headers['headers']);
			$this -> response -> setBody($body);
			$this -> response -> setStatus($headers['status']);
			$this -> response -> setCookies($this -> parseCookies($response));
			$this -> response -> setResponse($response);

			if(true === (json_last_error() == JSON_ERROR_NONE)) {
				$this -> response -> setJson($json);
			}
		}

		$this -> response -> setInfo(curl_getinfo($curl));

		curl_close($curl);

		return $this;
	}
346757
public function send ()
    {
        if ($this->_sent) {
            throw new CAS_OutOfSequenceException(
                'Request has already been sent cannot send again.'
            );
        }
        if (is_null($this->url) || !$this->url) {
            throw new CAS_OutOfSequenceException(
                'A url must be specified via setUrl() before the request can be sent.'
            );
        }
        $this->_sent = true;
        return $this->sendRequest();
    }