Skip to content
Advertisement

How to loop through CURLOPT_POSTFIELDS data with multiple id’s PHP

I have an order that has multiple line items (in particular 15) and I am trying to loop through id’s with params What am I missing here?:

JavaScript

the out put looks like this:

JavaScript

but it needs to be like this for each line item:

JavaScript

here is the CURL for a single id:

JavaScript

here is the CURL i’ve tried for multiples id’s with the foreach above.:

JavaScript

but this is the output I get for each line item:

JavaScript

Advertisement

Answer

The error you get is not related to the array, it says that the data is sent empty.

It could be that you didn’t enable the POST request on the curl connection causing this.

JavaScript

Array Example;

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement