This question already has an answer here:
Pls mention how to change below mentioned lines to POST method to send sms..
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://xxxxxxx.com/api/sendmsg.php?user=$user&pass=$pwd&sender=$sender&phone=$pno&text=".urlencode($_REQUEST['MESSAGE'])."&priority=ndnd&stype=normal");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
</div>
This will work :
$toPost = array("user" => $user,
"pass" => $pwd,
"sender" => $sender,
"phone" => $pno,
"text" => urlencode($_REQUEST['MESSAGE']),
"priority" => "ndnd",
"stype" => "normal"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://xxxxxxx.com/api/sendmsg.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // If you use this line, you will get response from API in $result below.
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $toPost);
$result = curl_exec($ch);
curl_close($ch);
The response returned by the API is in the $result
variable.