Send SMS Message by php using array
I have an account with an SMS gateway, and I want to send SMS messages in PHP language. I discovered in the User Guide that this is the code to use to send SMS messages.
$xmlString='data=<BILGI>
<KULLANICI_ADI>username</KULLANICI_ADI>
<SIFRE>password</SIFRE>
<BASLIK>subject</BASLIK>
</BILGI>
<ISLEM>
<YOLLA>
<MESAJ>hello from NetCom </MESAJ>
<NO>xxxxxxxxx phone number</NO>
</YOLLA>
</ISLEM>';
//API URL
$postUrl='http://www.smsala.com/services/api.php?islem=sms';
$Veriler = $xmlString;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $postUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $Veriler);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);
With the above code, I am able to send SMS messages, but I would like to pass an array to pass an attribute of the message.
I have an account with an SMS gateway, and I want to send SMS messages in PHP language. I discovered in the User Guide that this is the code to use to send SMS messages.
$xmlString='data=<BILGI>
<KULLANICI_ADI>username</KULLANICI_ADI>
<SIFRE>password</SIFRE>
<BASLIK>subject</BASLIK>
</BILGI>
<ISLEM>
<YOLLA>
<MESAJ>hello from NetCom </MESAJ>
<NO>xxxxxxxxx phone number</NO>
</YOLLA>
</ISLEM>';
//API URL
$postUrl='http://www.smsala.com/services/api.php?islem=sms';
$Veriler = $xmlString;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $postUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $Veriler);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);
With the above code, I am able to send SMS messages, but I would like to pass an array to pass an attribute of the message.
$destination = array("messageId" => $messageId,
"to" => $to);
$message = array("from" => $from,
"destinations" => array($destination),
"text" => $text,
"notifyUrl" => $notifyUrl,
"notifyContentType" => $notifyContentType,
"callbackData" => $callbackData);
This would make SMS configuration much easier. How can I create an array of information and use curl to send it? I hope I explained it correctly.