Panacea Mobile Help Centre
  • 👋Welcome to Panacea Mobile!
  • Overview
    • Getting Started
    • Multipart SMS
    • Unicode Characters
    • SMS Delivery Statuses
      • Troubleshooting SMS Delivery
    • Compliance
    • FAQs
    • International SMS
      • 🚧Country Regulations & Requirements (under construction)
  • How To Guides
    • Panacea Mobile Dashboard
    • Send a single SMS
    • Send batch campaigns
    • Send personalised batch campaigns
    • Inbox
    • Inbound Triggers
    • SMS Numbers
    • Blocked Numbers & Opt-Outs
    • Sub Accounts
    • Reporting
    • Adding prepaid credits
    • Account Settings
      • My Profile
      • My Billing
      • Security
  • Developers
    • HTTPS API
      • Single Sends
      • Batch Sends
      • Delivery Reports via API
      • Receiving Inbound SMS
      • API Response Code
      • API Keys
      • Examples
        • PHP
          • PHP API Example
          • Simple SMS Send
          • Bulk SMS Send
          • Batch Create
          • Batch Create (.zip)
          • Message Status
        • Python
          • Python API Example
    • SMPP API
      • SMPP Connection Details
  • USSD
    • What is USSD?
    • USSD Campaigns
    • Integration with your server
  • Reseller Platform
    • Reseller Platform Features
    • Getting Started
    • Reseller Settings
    • Managing Your Customer Accounts
    • Branded Platform Example
    • FAQs
Powered by GitBook
On this page

Was this helpful?

  1. Developers
  2. HTTPS API
  3. Examples
  4. PHP

Batch Create

<?php
require_once("panacea_api.php");
$api = new PanaceaApi();
$api->setUsername("demouser");
$api->setPassword("demouser");

$file = "../generic/mybatch.csv";

$result = $api->batch_create("My batch name", $file);

if($api->ok($result)) {
	/* Batch created ! */
	
	$batch_id = $result['details'];
	
	echo "Batch created with ID {$batch_id}\n";
	
	/* Let's create another one from XLS */
	
	$file = "../generic/mybatch.xls";
	
	$result = $api->batch_create("My second batch", $file, 0, false, 'xls');
	
	if($api->ok($result)) {
		echo "XLS Batch created!\n";
		
		/* Give it a moment to parse */
		sleep(1);
		
		$status = $api->batch_check_status($result['details']);
		
		
		
		
		

		if($status['details']['status'] == 32) { // Is it currently paused and waiting?
			$api->batch_start($result['details']);
			
			/* Let's wait a while and see if it's done */
			
			sleep(2);
			
			$status = $api->batch_check_status($result['details']);
			
		}
		
	}
	
	
}

?>
PreviousBulk SMS SendNextBatch Create (.zip)

Last updated 1 year ago

Was this helpful?