I am trying to send sms to mobile numbers of users in my project. I need to send sms by using xml format given by sms provider and it is shown below.
<MESSAGE>
<AUTHKEY>Authentication Key </AUTHKEY>
<SENDER>SenderID</SENDER>
<ROUTE>Template</ROUTE>
<CAMPAIGN>XML API</CAMPAIGN>
<SMS TEXT="message1" >
<ADDRESS TO="number1"></ADDRESS>
<ADDRESS TO="number2"></ADDRESS>
</SMS>
</MESSAGE>
My program forsending SMS is given below
public function sendUserSms()
{
$usernos = array();
$users = User::all();
foreach ($users as $key => $user) {
$xmlpno = new SimpleXMLElement("<ADDRESS></ADDRESS>");
$xmlpno->addAttribute('TO', $user->mobile);
$usernos[] = (string) $xmlpno;
}
}
$xmlmsg = '<MESSAGE>
<AUTHKEY>Authentication Key </AUTHKEY>
<SENDER>SenderID</SENDER>
<ROUTE>Template</ROUTE>
<CAMPAIGN>XML API</CAMPAIGN>
<SMS TEXT="hello_test_message" >'.implode($usernos).'
</SMS>
</MESSAGE>';
var_dump($xmlmsg);
It shows nothing. Anybody know what is the problem? Can anyone help?