When you API call from the browser or Any Rest Client then it’s work fine but when API call from curl then it gives bad request. you need change your PHP curl request as per below code.
1 2 3 4 5 6 7 8 9 10 11 12 |
$command="http://api.abcd.com"; $ch = curl_init($command); $fields['phone']=$param['phone']; curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $res = curl_exec($ch); curl_close($ch); |
More Stories
CPU & Memory usage in PHP
Install PHP mcrypt extension on Ubuntu
Text to speech