NetGsmin vermiş olduğu api aşağıdaki gibidir.
<?php
function sendsms($msg, $telno, $header)
{
$username= "";
$pass= "";
$startdate=date('d.m.Y H:i');
$startdate=str_replace('.', '',$startdate );
$startdate=str_replace(':', '',$startdate);
$startdate=str_replace(' ', '',$startdate);
$stopdate=date('d.m.Y H:i', strtotime('+1 day'));
$stopdate=str_replace('.', '',$stopdate );
$stopdate=str_replace(':', '',$stopdate);
$stopdate=str_replace(' ', '',$stopdate);
$url="http://api.netgsm.com.tr/bulkhttppost.asp?usercode=$username&password=$pass&gsmno=$telno&message=$msg&msgheader=$header&startdate=$startdate&stopdate=$stopdate";
//echo $url;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
// curl_setopt($ch,CURLOPT_HEADER, false);
$output=curl_exec($ch);
curl_close($ch);
return $output;
}
$mesaj=$_POST['mesaj'];
$tel='$_POST['tel']';
$baslik='$_POST['baslik']';
echo sendsms($mesaj,$tel,$baslik);
?>Form içeriğine örnek olarak "test" yazıyorum ve gönder dediğimde mesajı cep telefonuna gönderiyor. o konuda sıkıntı yok fakat "test test" yazdığımda yani herhangi bir boşluk kullanımında Bad Request HTTP Error 400. The request is badly formed hatası alıyorum. Bunun sebebi nedir nasıl çözebilirim? Konu hakkında bilgisi olan arkadaşlar yardımlarını esirgemesse sevinirim. Hayırlı akşamlar.