I need to send data by get and get what to return to know if it worked or not, however, with cURL and file_get_contents is not giving (seems to be something of the server that receives the request), hence I'm trying to use Guzzle, I did a test here and it seems not to have caused problems, however, I'm not sure how to see the return of the request, I'm doing this:
require_once 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Message\Request;
use GuzzleHttp\Message\Response;
$client = new Client();
$response = $client->get('http://www.endereco.com.br?dados');
var_dump($response->getBody());
It prints this on my screen:
object (GuzzleHttp \ Psr7 \ Stream) # 24 (7) { ["stream": "GuzzleHttp \ Psr7 \ Stream": private] = > resource (5) of type (stream) ["size": "GuzzleHttp \ Psr7 \ Stream": private] = > NULL ["seekable": "GuzzleHttp \ Psr7 \ Stream": private] = > bool (true) ["readable": "GuzzleHttp \ Psr7 \ Stream": private] = > bool (true) ["writable": "GuzzleHttp \ Psr7 \ Stream": private] = > bool (true) ["uri": "GuzzleHttp \ Psr7 \ Stream": private] = > string (10) "php: // temp" ["customMetadata": "GuzzleHttp \ Psr7 \ Stream": private] = > array (0) { } }
How to get the HTML or json with the server response?!
Vlw.