lundi 4 juin 2018

I am using foreach to iterate over an array and send sms to each nos,but not able to do so.It send to only a single

The 2nd foreach should send to each new_token->mob .but it sends to one and then stops.what am doing wrong?

My code is:

foreach($new_tokens as $new_tokenss) 
{ 
   foreach($new_tokenss as $new_token) 
   {

            $message = "Message";
            $message_encoded = urlencode($message);
            $postData = array(
                'authkey' => \Config::get('procedures.msg91.authKey'),
                'mobiles' => $token3[0],
                'message' => $message_encoded,
                'sender' => \Config::get('procedures.msg91.senderId'),
                'route' => \Config::get('procedures.msg91.route')
            );

            $curl = new \anlutro\cURL\cURL;
            $curl->post(\Config::get('procedures.msg91.api_url'), $postData);
            return 'New emergency patient';
   }

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire