Jump to content

Need help with Array


aron4588

Recommended Posts

Hey i need help, right now my script connect to an api and send a sms, 1 number at a time, I want it to pull from a local sql db then repeat the response for each number in the db!

 

`$data['post'] = array ( '_rnr_se' => $rnrse, 'phoneNumber' => '1234567890', 'text' => 'This is a test SMS!', 'id' => '' );

// Send the SMS 
$response = xcurl::fetch('api.phonegateway.com/', $data);

// Evaluate the response 
$value = json_decode($response['data']);`

 

Link to comment
https://forums.phpfreaks.com/topic/206033-need-help-with-array/
Share on other sites

Just one way you could do this.. not the best IMHO, but would work.

 

$numbers = array('15555555555', '15555555556', '15555555557');

foreach($numbers as $k => $v){
     $data['post'] = array ( '_rnr_se' => $rnrse, 'phoneNumber' => $v, 'text' => 'This is a test SMS!', 'id' => '' );

     // Send the SMS 
     $response = xcurl::fetch('api.phonegateway.com/', $data);

     // Evaluate the response 
     $value = json_decode($response['data']);
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.