1

Some API is providing json file of 88MB. I need to store in some of its value in database.

$cURL="url here"
$str = file_get_contents($cURL);
$str = json_decode($str);
echo '<pre>';
print_r($str);   

this code is not working because file size is too large. I need to convert that json file to a php array. I am not able to parse this file. Any help from anyone?

Cactus
  • 27,075
  • 9
  • 69
  • 149

1 Answers1

1

Quite complicated if the problem should be solved during the query. Caching the preliminary data on the filesystem then separate the values into chunks would be able to solve the issue.

  • I know parsing will help but how to parse it? i have tried a few techniques but not helping. – Roushan Choudhary Jan 19 '15 at 06:19
  • A little code would give me an insight to help you. I need you to answer some specific questions though, a) Data being returned b) Specific keys to be used –  Jan 19 '15 at 06:22
  • i already gave you code in the question. in first line i took the url in a variable. if i run that url in browser, that will download a json file of 88MB – Roushan Choudhary Jan 19 '15 at 06:27
  • The code above is vague and unhelpful. Since it's a JSON response, there's undoubtedly chunks of keys lying around in which you can omit. –  Jan 19 '15 at 06:32