Sorry, I was not available much lately. I just reviewed your posted code. I do not think you can index cURL objects as an array entry. An array of objects may interfere with the use of the object. I understand why you might want to index an array of material codes sent by Json, but there is no reason to create an array of all the cURL objects. Why waste the processing time to index them all. Just loop thru the material codes, process the cURL for each and store the results into your indexed results array. Just do not using indexing of the cURL objects. ( Meaning $client. as each curl call is a process of it’s own. )
Not sure if that makes sense or not, but, try removing all the indexing from the curl sections…
( By the way, what line gave you the “cannot use temporary expression” error??? )