PHP SMS API example


<?php
$token = "your.token"; // https://my.smsfactor.com/developers/api-tokens
$content = "Test API";
$numbers = array('0601020304','0704030201');
$sender = "PHP";
$recipients = array();
foreach ($numbers as $n) {
  $recipients[] = array('value' => $n);
}

$postdata = array(
  'sms' => array(
   'message' => array(
    'text' => $content,
    'sender' => $sender
   ),
   'recipients' => array('gsm' => $recipients)
  )
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.smsfactor.com/send");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Authorization: Bearer ' . $token));
$response = curl_exec($ch);
curl_close($ch);
  	
	

When should you use a PHP SMS API?

Efficiently automate your communications with our PHP-compatible SMS API!

Simply integrate SMS sending into your PHP applications to optimize your communication processes. With our flexible, easy-to-integrate API, you can send SMS directly from your PHP applications with just a few lines of code.

Here are just a few examples:

  • Sending SMS messages when a new order is placed in your online store.
  • SMS notification when a reservation is confirmed on your booking platform.
  • Instant communication with your users for event reminders or critical alerts.
  • Set up two-factor authentication to reinforce user account security.
  • Launch SMS promotional campaigns targeting your service users.
  • Automatically send SMS messages to relaunch an abandoned shopping cart, confirm account creation, finalize a purchase or announce shipment of a parcel.

Why choose SMSFactor's SMS PHP API?

Choose the SMSFactor API and benefit from personalized technical support. Our team is here to help you every step of the way to integrate our PHP API. Benefit from high-quality technical support and advice on best practices.

You'll also benefit from a secure and reliable SMS PHP API with 99.9% uptime. Your data is secure and RGPD-compliant, with strict anti-flood protection measures.

Our scalable API offers advanced features to maximize the effectiveness of your SMS campaigns:

  • Receipt of SMS responses and acknowledgements for precise tracking of your KPIs.
  • Automated unsubscribe management for opt-out compliance.
  • Use of webhooks to manage and store your dispatch data.
  • Simulated mailings to test your configurations before launching them.
  • Insertion of tracked short links to monitor and optimize the traffic generated by your SMS messages.