Right now i am facing a problem in executing api for sms gateway. They asked me to hit a url and which is http://bulksmsgateway.in/sendmessage.php?user=........&password=.......&mobile=........&message=.......&sender=.......&type=3
but i have to do it without loading this url in a browser. so i used curl method. and where i get a 400 bad request error.It's a windows server with PHP support.
my code is here below -
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$contents = curl_exec($ch);
$ee = curl_getinfo($ch);
print_r($ee);
curl_close($ch);
if ($contents){ echo 'sent'; print_r($contents); }else{ echo 'lost'; }
the $ee returns
Array ( [url] => http://bulksmsgateway.in/sendmessage.php?user=usrname&password=pwd&mobile=9126050xxx&message=Thanking you for ordering through FCI.Your Order will be delivered on time.Your order no is 000198.Please keep it for future reference.&sender=SUBANK&type=3
[content_type] => text/html; charset=iso-8859-1
[http_code] => 400
[header_size] => 145
[request_size] => 411
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.094
[namelookup_time] => 0
[connect_time] => 0.047
[pretransfer_time] => 0.047
[size_upload] => 0
[size_download] => 299
[speed_download] => 3180
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => 0
[starttransfer_time] => 0.094
[redirect_time] => 0
[certinfo] => Array
(
)
[redirect_url] =>
)
I think the problem is in the message portion. the space in message in url getting error.because a message without space sent successfully. a   also is not working.and waht for fullstop(.).please help me in this regards.
thanks in advance.