call API many times but eventually run into error, PHP

in Development
Hi,
I have trouble on multiple calls on api, due to my company policy I can only show my problem as following example
I have an array contains all my products, which is around 500
then for each of item in this array
execute: $product=$api->products->get($the_product_id);
the type of $the_product_id is integer,
when I run the PHP application, first time only shows part of result, after I refresh the page, the application crashed.
I assume this have something to do with api calls time out, but I am not sure.
Please help me with some idea that allows me call api functions hundreds times,
Thank you very much!
I have trouble on multiple calls on api, due to my company policy I can only show my problem as following example
I have an array contains all my products, which is around 500
then for each of item in this array
execute: $product=$api->products->get($the_product_id);
the type of $the_product_id is integer,
when I run the PHP application, first time only shows part of result, after I refresh the page, the application crashed.
I assume this have something to do with api calls time out, but I am not sure.
Please help me with some idea that allows me call api functions hundreds times,
Thank you very much!
4 comments
Adrian Samuel
Software Developer
Lightspeed HQ
the functions I made can execute without error, and there is a loop inside of function, once I add this line in the loop " $product=$api->products->get($the_product_id);", (the loop is normally 500 times in my project.) the function is not working anymore, and the only error message I have is 500...
so I am struggling to find out what's is the reason of this error
Adrian Samuel
Software Developer
Lightspeed HQ
thank you for your response !