Could anyone please tell me what am I doing wrong here while sending the serialized data via POST using curl below:
$urlTest = ‘http://localhost:9090/JAXRS_POST_Request/rest/Request/insertDataToDB’;
$rCURL = curl_init();
curl_setopt($rCURL, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($rCURL, CURLOPT_POSTFIELDS, $_POST["myData"]);
curl_setopt($rCURL, CURLOPT_URL, $urlTest);
curl_setopt($rCURL, CURLOPT_HEADER, 0);
curl_setopt($rCURL, CURLOPT_RETURNTRANSFER, 1);
$response_post = curl_exec($rCURL);
curl_close($rCURL);
$_POST["mydata"]
contains the following :
[{ "name": "FirstName", "value": "Mickey" }, { "name": "LastName", "value": "Mouse" }]
I have tested the webservice by sending request separately via POSTMAN client and it works there.