PHP cURL not allowed multidimentional array

Posted on

Assalamu’alaikum warahmatullah wabarakatuh

In this case, I running on project at work, build the main portal project. The portal should use so many database from any host. We can’t build it ini one big systems, it’s not good for maintenance and the source sistem is available before.

My department made Rest Api’s system to control the data. Using PHP, and the most popular framework for systems and plugins it was developed.

Today I get some trouble when I post the data to rest server. I was test it in Postman, and work correctly. But, when I try to send the data using PHP cURL, it’s not work.

Here the solution

My friends told me to encode the data as json data before posting. And, well, it’s work. I use system helper and rest plugin, so not using self code to build rest. In my system helper, I found errror at:

The $data[] is not allowing multidimentional array. As you know, the array just fill by field. And the sub array was nulled. When I encode the $data before post, I have the result as json data and the multidimetional array is work correctly.

Just a little notes for my future.

Wassalamu’alaikum warahmatullah