Code: Select all
$httpFactory = new HttpFactory();
$http = $httpFactory->getHttp();
$response = $http->get("example_url",array("Content-Type" => "application/json","Accept" =>"application/json"));
$bodyStream = $response->getBody();
$body = $bodyStream->getContents();
Code: Select all
object(Laminas\Diactoros\Stream)#181 (2) {
["resource":protected]=>
resource(212) of type (stream)
["stream":protected]=>
string(12) "php://memory"
}
How can I take the body of the url with the get method of HttpFactory?