I am using laravel 5.5.*
and guzzlehttp/guzzle ^6.3
. I have created APIs in the same project (using laravel api.php
) and consuming API on the same project (using laravel web.php
) and given throttle 120 per second
.
everything was working properly but suddenly got following error while parsing using guzzle
{
"error": "FatalErrorException",
"reason": "Allowed memory size of 536870912 bytes exhausted (tried to allocate 266342400 bytes)",
"code": 1,
"trace": []
}
Using XAMPP server
and memory_limit=2048M
.
If I access API in the browser it loads fine
Guzzle parsing code below
$client = new Client([
'base_uri' => env('API_URL'),
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'],
'debug' => true,
]);
Please, someone, help me how I can fix it? even I cleared cache also generated a new key