Skip to content

How do I emulate a typical request #66

Answered by hollodotme
john-everden asked this question in Q&A
Discussion options

You must be logged in to vote

Hi John, thanks for your request!

In the code above you did not add any content that would fill the $_REQUEST array as far as I can see.

In order to do so you'd need to pass data to the second parameter for the GetRequest instance.

For example, if you want to have "Hello world" as the value of the key "test" in your $_REQUEST array, the code would look like this:

$client     = new Client();
$connection = new NetworkSocket('localhost', 9000);

$data = [
    'test' => 'Hello world',
];

$content = http_build_query($data);

$request    = new GetRequest('/var/ci4/public/index.php', $content);
$request->setRequestUri('/home/testagain');
$response = $client->sendRequest($connection, $request);
e…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hollodotme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants