public function requestCommand($requestUrl)
    {
        // TODO: this needs heavy cleanup!
        $template = file_get_contents(__DIR__ . '/../../../Resources/Private/Templates/request.tpl');
        $arguments = [
            'documentRoot' => getenv('TYPO3_PATH_WEB') ?: PATH_site,
            'requestUrl' => $this->makeAbsolute($requestUrl),
        ];
        // No other solution atm than to fake a CLI request type
        $code = str_replace('{arguments}', var_export($arguments, true), $template);
        $process = new PhpProcess($code, null, null, 0);
        $process->mustRun();
        $rawResponse = json_decode($process->getOutput());
        if ($rawResponse === null || $rawResponse->status === 'failure') {
            $this->outputLine('<error>An error occurred while trying to request the specified URL.</error>');
            $this->outputLine(sprintf('<error>Error: %s</error>', !empty($rawResponse->error) ? $rawResponse->error : 'Could not decode response. Please check your error log!'));
            $this->outputLine(sprintf('<error>Content: %s</error>', $process->getOutput()));
            $this->quit(1);
        }

        $this->output($rawResponse->content);
    }
public function requestCommand($requestUrl)
    {
        // TODO: this needs heavy cleanup!
        $template = file_get_contents(__DIR__ . '/../../../Resources/Private/Templates/request.tpl');
        $arguments = [
            'documentRoot' => getenv('TYPO3_PATH_WEB') ?: PATH_site,
            'requestUrl' => $this->makeAbsolute($requestUrl),
        ];
        // No other solution atm than to fake a CLI request type
        $code = str_replace('{arguments}', var_export($arguments, true), $template);
        $process = new PhpProcess($code, null, null, 0);
        $process->mustRun();
        $rawResponse = json_decode($process->getOutput());
        if ($rawResponse === null || $rawResponse->status === 'failure') {
            $this->outputLine('<error>An error occurred while trying to request the specified URL.</error>');
            $this->outputLine(sprintf('<error>Error: %s</error>', !empty($rawResponse->error) ? $rawResponse->error : 'Could not decode response. Please check your error log!'));
            $this->outputLine(sprintf('<error>Content: %s</error>', $process->getOutput()));
            $this->quit(1);
        }

        $this->output($rawResponse->content);
    }
public function requestCommand ( $ requestUrl ) { // TODO: this needs heavy cleanup! $ template = file_get_contents ( __DIR__ . '/../../../Resources/Private/Templates/request.tpl' ) ; $ arguments = [ 'documentRoot' => getenv ( 'TYPO3_PATH_WEB' ) ? : PATH_site , 'requestUrl' => $ this -> makeAbsolute ( $ requestUrl ) , ] ; // No other solution atm than to fake a CLI request type $ code = str_replace ( '{arguments}' , var_export ( $ arguments , true ) , $ template ) ; $ process = new PhpProcess ( $ code , null , null , 0 ) ; $ process -> mustRun ( ) ; $ rawResponse = json_decode ( $ process -> getOutput ( ) ) ; if ( $ rawResponse === null || $ rawResponse -> status === 'failure' ) { $ this -> outputLine ( '<error>An error occurred while trying to request the specified URL.</error>' ) ; $ this -> outputLine ( sprintf ( '<error>Error: %s</error>' , ! empty ( $ rawResponse -> error ) ? $ rawResponse -> error : 'Could not decode response. Please check your error log!' ) ) ; $ this -> outputLine ( sprintf ( '<error>Content: %s</error>' , $ process -> getOutput ( ) ) ) ; $ this -> quit ( 1 ) ; } $ this -> output ( $ rawResponse -> content ) ; }
Submit frontend request

Submits a frontend request to TYPO3 on the specified URL.

@param string $requestUrl URL to make a frontend request.
Submit frontend request