Reputation: 83
I am facing issue in my code, when I am trying to store the file_get_contents output into an obj.
$json = file_get_contents($url);
$obj = json_decode($obj);
I am not allowed to change the memory size in ini.php because it is on server.Any other solution for this.?
Upvotes: 0
Views: 1486
Reputation: 2657
Have you tried other options of increasing memory limit? Like
ini_set('memory_limit', '-1'); //change the -1 to a value that acommodates to your use case
$json = file_get_contents($url);
$obj = json_decode($json);
Upvotes: 1
Reputation: 6836
You have a simple typo:
$json = file_get_contents($url);
$obj = json_decode($json);
Upvotes: 2