I am using indiasms's api with curl to send sms
<?php
$url = "http://12.23.54.18/api/smsapi.aspx?username=myusername&password=mypassword&to=7897015426&from=DEMOAB&message=Your message content.";
$curl = curl_init($url);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Codular Sample cURL Request'
));
$resp = curl_exec($curl);
curl_close($curl);
?>
Whenever I run this script I get
Bad Request
HTTP Error 400. The request is badly formed.
What i am doing wrong. ??
Update But when i run without curl it works fine
<a href="http://12.23.54.18/api/smsapi.aspx?username=myusername&password=mypassword&to=7897015426&from=DEMOAB&message=Your message content.">Send Message</a>
When i click this link it works normally
Supposedly the direct link works, because all headers needed for the request was sent.
I believe the lack of
User-Agent:
header orConnection:
headerTry this:
If not work, try add,
Connection:
header:If not work, try enconde your "message" before send: