Perform execute_multiple using PHP API


  1. <?php
  2. require_once("panacea_api.php");

  3. /* This sample demonstrates how to send multiple actions to the API in a single request */

  4. $api = new PanaceaApi();
  5. $api->setUsername("demouser");
  6. $api->setPassword("demouser");

  7. /* Now we must change mode from immediate to delayed */

  8. $api->performActionsImmediately(false);

  9. /* Let's queue our requests */
  10. $api->message_send("27111234567", "Message 1", "27111234567");
  11. $api->message_send("27111234568", "Message 2", "27111234568");
  12. $api->message_send("27111234569", "Message 3", "27111234569");

  13. /* Now let's send them */
  14. $results = $api->execute_multiple();

  15. if($api->ok($results)) {
  16. /* API Received the requests, we can now process each individual action's result */

  17. foreach($results['details'] as $result) {
  18. if($api->ok($result)) {
  19. /* Successful result */

  20. } else {

  21. }
  22. }

  23. }

  24. ?>