I have written an API for updating the User information using the PUT method & here is the cURL code :
$postData = http_build_query($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $curlUrl);
//curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS,$postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
Here $data is the Associative array (key=>value pair). After the request is done in the API end. I'm getting the response as :
11{"Status":200,"Response":"Success","ResponseData":"User Information updated successfully"}
Here, in the response. I'm not able to figure out why that integer value 11 is coming. Please do provide the reason & how to fix it.
thanks in advance, Srinivasu....
In that API function 11
is attaching, means there should be some echo
before you are sending proper response. So, please go through your code and comment extra echo
that will solve your Problem.
EDIT
This 11
may be before you are actually sending/returning response.
Thanks Cafonso & A.P for your answer. I have checked my Query for the echo statement & found one of the echo which is generating the 11 integer value..
Thanks for the solution..