I have an application that needs to read external data, ie another URL
, I'm necessarily doing it with Guzzle
, but when I convert to json
to mount the array with the data, it returns null.
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\RequestException;
class salarioController extends Controller
{
public function index()
{
$client = new Client();
$response = $client->get('http://www.guiatrabalhista.com.br/guia/salario_minimo.htm');
$body = json_decode($response->getBody(), TRUE);
}
}
The result of $body
is empty.