I get JSON, which I can get with php: // input, and I need to send it back to another url, but I'm not sure how to format it. This is how I get it:
$ updates = file_get_contents ("PHP: // input");
I could json_decode and then parse the array so that it matches normal POST-like requests like hello = world & stack = overflow etc. But is it possible to pass JSON only in curl post like this
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $updates);
and then the client can just enter php: // to capture the data again? The reason I ask is because the client says that it is not receiving data, it may not have configured it correctly. I noticed that when you do something like this via the command line, you must include -H in the command so that the data is interpreted as regular POST, maybe libcurl CURLOPT should be installed there?
Thank!
source
share