Execute request

@return string Response
334289
public function execute()
    {
        $rawResponse        = curl_exec($this->handle);
        $this->responseCode = curl_getinfo($this->handle, CURLINFO_HTTP_CODE);

        if(false === $rawResponse)
        {
            curl_close($this->handle);
            throw new ConnectorException('Unable to connect to CORAL backend. Response code: ' . $this->responseCode);
        }

        $this->responseHeaderSize = curl_getinfo($this->handle, CURLINFO_HEADER_SIZE);
        curl_close($this->handle);

        return $rawResponse;
    }
101465
public function exec()
    {
        // Set the header
        $this->buildHttpHeader();

        $parameters = [
            'headers' => $this->headers,
            'body' => $this->postFields,
            'curl' => $this->setPostCurlopts(),
        ];

        // Get all of the results 1000 at a time
        return  $this->sendData('POST', $parameters);
    }
152119
public function execute()
    {
        $body = $this->phpci->interpolate($this->message);

        $client = new \Maknz\Slack\Client($this->webHook);

        $message = $client->createMessage();

        if (!empty($this->room)) {
            $message->setChannel($this->room);
        }

        if (!empty($this->username)) {
            $message->setUsername($this->username);
        }

        if (!empty($this->icon)) {
            $message->setIcon($this->icon);
        }

        // Include an attachment which shows the status and hide the message
        if ($this->show_status) {
            $successfulBuild = $this->build->isSuccessful();

            if ($successfulBuild) {
                $status = 'Success';
                $color = 'good';
            } else {
                $status = 'Failed';
                $color = 'danger';
            }

            // Build up the attachment data
            $attachment = new \Maknz\Slack\Attachment(array(
                'fallback' => $body,
                'pretext'  => $body,
                'color'    => $color,
                'fields'   => array(
                    new \Maknz\Slack\AttachmentField(array(
                        'title' => 'Status',
                        'value' => $status,
                        'short' => false
                    ))
                )
            ));

            $message->attach($attachment);

            $body = '';
        }

        $message->send($body);

        return true;
    }
430085
protected function execute()
    {
        $response = $this->service->IPGApiAction($this);

        if ($response instanceof Error) {
            return $response;
        }

        if ($this->function === self::FUNCTION_INSTALL) {
            return new Sell($response);
        }

        return new ConfirmRecurring($response);
    }
687710
function run()
    {
        $request  = $this->getServerRequest();
        $response = $this->getResponse();
        $uri      = $request->getUri();
        $basepath = $uri->getBasePath();
        $args     = explode('/', htmlspecialchars($basepath));

        $response = $this->process($request, $response, $args);

        $this->finalize($request, $response, $args);
    }
233101
public function execute() {

		$urlComponents = $this->getUrlComponents( $this->getOption( ONOI_HTTP_REQUEST_URL ) );

		$resource = $this->getResourceFromSocketClient(
			$urlComponents,
			$this->getOption( ONOI_HTTP_REQUEST_SOCKET_CLIENT_FLAGS )
		);

		// Defaults
		$requestResponse = new RequestResponse( array(
			'host' => $urlComponents['host'],
			'port' => $urlComponents['port'],
			'path' => $urlComponents['path'],
			'responseMessage'  => "$this->errstr ($this->errno)",
			'followedLocation' => false,
			'wasCompleted' => false,
			'wasAccepted'  => false,
			'connectionFailure' => -1,
			'requestProcTime'   => microtime( true )
		) );

		$this->doMakeSocketRequest(
			$urlComponents,
			$resource,
			$requestResponse
		);

		$this->postResponseToCallback(
			$requestResponse
		);

		return $requestResponse->get( 'wasCompleted' );
	}
823981
final public function execute($options = null)
    {
        return $this
            ->getHttpClient()
            ->request(
                $this->method(), 
                $this->uri(), 
                $options ?: $this->options()
            );
    }
64193
public function run() {

        foreach ( $this->requests as $request ) {

            if ( isset($request['ERROR_CODE']) && isset($request['ERROR_MESSAGE']) ) {

                $this->logger->warning("Invalid request ".$request['ID']);

                $result = self::packJsonError($request['ERROR_CODE'], $request['ERROR_MESSAGE'], $request['ID']);

                if ( !is_null($result) ) $this->results[] = $result;

            } else {

                try {

                    $this->logger->debug("Serving request ".$request['METHOD']."(".$request['ID'].")");

                    $response = $this->runSingleRequest($request['METHOD'], $request['PARAMETERS']);

                    $result = self::packJsonSuccess($response, $request['ID']);

                } catch (RpcException $re) {

                    $this->logger->warning("Error handling request ".$request['ID'].": ".$re->getMessage());

                    $result = self::packJsonError($re->getCode(), $re->getMessage(), $request['ID']);

                } catch (Exception $e) {

                    $this->logger->error($e->getMessage());

                    throw $e;

                }

                if ( !is_null($result) ) $this->results[] = $result;

            }


        }

        if ( empty($this->results) ) {

            return null;

        } else if ( $this->is_batch_request ) {

            return $this->results;

        } else {

            return $this->results[0];

        }

    }
879359
protected function executeRequest()
    {
        // @todo encode response add to array, pass to response

        $result = array();

        foreach ($this->request->getClassifiers() as $classifierString) {
            $classifier = explode('/', $classifierString);

            if (! $this->classifierExists($classifierString)) {
                throw new Exception\ServiceReaderException("Classifier {$classifierString} does not exist");
            }

            $queryURL = sprintf(
                $this->apiQueryStringRequestFormat,
                $this->apiEndpoint,
                rawurlencode($classifier[0]),
                rawurlencode($classifier[1]),
                urlencode($this->apiKey),
                urlencode($this->request->getTextData()),
                $this->apiVersion,
                strtolower($this->request->getResponseFormat()) !== 'xml' ?
                "&output={$this->request->getResponseFormat()}" : null
            );

            if (!is_callable('curl_init')) {
                throw new Exception\ServiceReaderException('cURL not found.');
            }

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_URL, $queryURL);
            $response = curl_exec($ch);
            curl_close($ch);

            if (strpos($response, "<Exception>") !== false) {
                preg_match("/<Exception\>(.*)<\/Exception>/mu", $response, $matches);
                throw new Exception\ServiceReaderException($matches[1]);
            }

            $result[$classifier[1]] = $response;
        }
        return new UclassifyResponse($result, $this->request);
    }
590758
public function execute()
    {
        $response = [];
        $valueName = $this->getRequest()->getParam('value');
        $conditionValue = $this->getRequest()->getParam('condValue');
        $attributeValue = $this->getRequest()->getParam('attributeValue');

        if ($valueName && $attributeValue && $conditionValue) {
            if ($conditionValue == 'null') {
                $valueOptions = $this->ruleValue->getValueSelectOptions($attributeValue, true);
                $response['cvalue'] = $this->getOptionHtml('cvalue', $valueName, $valueOptions);
            } else {
                $elmType = $this->ruleValue->getValueElementType($attributeValue);
                if ($elmType == 'select') {
                    $valueOptions = $this->ruleValue->getValueSelectOptions($attributeValue);
                    $response['cvalue'] = $this->getOptionHtml('cvalue', $valueName, $valueOptions);
                } elseif ($elmType == 'text') {
                    $html = "<input style='width:160px' title='cvalue' class='' id='' name=$valueName />";
                    $response['cvalue'] = $html;
                }
            }
            $this->http->getHeaders()->clearHeaders();
            $this->http->setHeader('Content-Type', 'application/json')->setBody(
                $this->jsonEncoder->jsonEncode($response)
            );
        }
    }
64839
public function execute()
    {
        $aClientConfig   = [
            'base_uri'        => $this->sBaseUri,
            'verify'          => !(Environment::is(Environment::ENV_DEV) || Environment::is(Environment::ENV_TEST)),
            'allow_redirects' => Environment::not(Environment::ENV_TEST),
            'http_errors'     => Environment::not(Environment::ENV_TEST),
        ];
        $aRequestOptions = [
            'headers' => $this->aHeaders,
        ];

        $this->compile($aClientConfig, $aRequestOptions);

        $oClient = Factory::factory('HttpClient', '', $aClientConfig);

        return Factory::factory(
            'HttpResponse',
            '',
            $oClient->request(static::HTTP_METHOD, $this->sPath, $aRequestOptions)
        );
    }
578478
public function execute (Request $request)
		{
			$parsed = $this->parseRouteRequest($request);

			$controller = $this->getController($request);

			return $controller->dispatch(
				$parsed['method'],
				$parsed['arguments']
			);
		}
424949
public function call() {
        $request = $this->createRequest();
        $response = $this->api->execute($request, $this);
        $this->response = $response;

        if ($this->shouldResponseBeProcessed($response)) {
            return $response->getBody();
        }
        return $response;
    }
1108958
public function execute()
    {
        $code = $this->getRequest()->getParam('code', false);
        $userId = $this->getRequest()->getParam('state');
        //load admin user
        $adminUser = $this->adminUser->create();
        $this->userResource->load($adminUser, $userId);
        //app code and admin user must be present
        if ($code && $adminUser->getId()) {
            $clientId = $this->scopeConfig->getValue(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_ID
            );
            $clientSecret = $this->scopeConfig->getValue(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CLIENT_SECRET_ID
            );
            //callback uri if not set custom
            $redirectUri = $this->storeManager->getStore()
                ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, true);
            $redirectUri .= 'connector/email/callback';

            $data = 'client_id=' . $clientId .
                '&client_secret=' . $clientSecret .
                '&redirect_uri=' . $redirectUri .
                '&grant_type=authorization_code' .
                '&code=' . $code;

            //callback url
            $url = $this->config->getTokenUrl();

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_TIMEOUT, 60);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);

            $response = json_decode(curl_exec($ch));

            if ($response === false) {
                $this->helper->error('Error Number: ' . curl_errno($ch), []);
            }
            if (isset($response->error)) {
                $this->helper->error('OAUTH failed ' . $response->error, []);
            } elseif (isset($response->refresh_token)) {
                //save the refresh token to the admin user
                $adminUser->setRefreshToken(
                    $this->helper->encryptor->encrypt($response->refresh_token)
                );

                $this->userResource->save($adminUser);
            }

            //redirect to automation index page
            return $this->_redirect($this->adminHelper->getUrl('dotdigitalgroup_email/studio'));
        }

        return $this->resultPageFactory->create()
            ->setStatusHeader(404, '1.1', 'Not Found')
            ->setHeader('Status', '404 File not found');
    }
1302194
public function createAndExecute() {
        $request = $this->createRequest();
        $response = $this->api->execute($request, $this);
        $this->response = $response;

        return $response;
    }
457892
public function execute(){
        $formOptions = $this->buildOptions();

        return $this->replaceTokens([
            ':options' => $formOptions,
            ':token_input' => true === $this->csrf ? $this->createCsrfField() : ''
        ]);
    }
1293000
public function executeAction()
    {
        $moduleClass = $this->get('request')->get('_module.module');
        $actionName = $this->get('request')->get('_module.action');

        $module = $this->get('module_manager')->get($moduleClass);
        foreach ($module->getControllerPreExecutes() as $controllerPreExecute) {
            if (null !== $retval = call_user_func($controllerPreExecute, $module)) {
                return $retval;
            }
        }

        return $module->getAction($actionName)->executeController();
    }