As using Guzzle to fill in a form from another site and get the result?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Learn how to work with Guzzle. Did a small exercise.

For example, on a third-party website there is form with method="post":
The user fills in a single field with name="title", pressing a button, the site throws it on result.phpthat gives the answer:
As on my website to programmatically fill this form and get a response?

Do the following code, but the post parameter is not passed. How to fix?
require 'vendor/autoload.php'; // Connect the Client class use GuzzleHttp\\Client; // The plug-in class Request use GuzzleHttp\\Psr7\equest; // Initialize a class to work with remote web resources $client = new Client(); // Initialize a class to work with remote web resource $request = new Request('POST', '', [ 'title' => 'Dubrovsky' ]); // Set an anonymous function that will handle the server's response $promise = $client->sendAsync($request)->then(function ($response) { echo $response->getBody(); }); // Start the connection to the remote resource and pass control for processing the response of an anonymous function $promise->wait();
by | 9 views

1 Answer

0 like 0 dislike
do a query on the final script, in your case it is result.php well, and the parameters of what the thread say.
// Initialize a class to work with remote web resource $request = new Request('GET', '');

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked May 21, 2019 by Wet_Dumplings
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
35,595 users