67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: freuddebian
|
|
* Date: 08/10/18
|
|
* Time: 11:47
|
|
*/
|
|
header('Content-type: application/json');
|
|
|
|
// Program SMSM Sending
|
|
/* Send an SMS using Twilio. You can run this file 3 different ways:
|
|
*
|
|
* 1. Save it as sendnotifications.php and at the command line, run
|
|
* php sendnotifications.php
|
|
*
|
|
* 2. Upload it to a web host and load mywebhost.com/sendnotifications.php
|
|
* in a web browser.
|
|
*
|
|
* 3. Download a local server like WAMP, MAMP or XAMPP. Point the web root
|
|
* directory to the folder containing this file, and load
|
|
* localhost:8888/sendnotifications.php in a web browser.
|
|
*/
|
|
|
|
// Step 1: Get the Twilio-PHP library from twilio.com/docs/libraries/php,
|
|
// following the instructions to install it with Composer.
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
require '../vendor/autoload.php';
|
|
use Twilio\Rest\Client;
|
|
|
|
// Step 2: set our AccountSid and AuthToken from https://twilio.com/console
|
|
$AccountSid = "ACacdb9c9601741af001ebbc7eca4969cd";
|
|
|
|
|
|
$AuthToken = "0aa2ed8f08775286180f8b40baaf57fb";
|
|
|
|
|
|
// Step 3: instantiate a new Twilio Rest Client
|
|
$client = new Client($AccountSid, $AuthToken);
|
|
|
|
$sender_name = "iLink World";
|
|
$sender_number = "+447400348273";
|
|
$phone="+24107300823";
|
|
|
|
$subject = "Nouvelle demande superviseur";
|
|
$email = "andymigoumbi@gmail.com";
|
|
$message = "Bonjour,\n\nUne nouvelle demande de superviseur a été enregistrée.
|
|
\nNumero de telephone : $phone \n\n\nCordialement,\nL'équipe Ilink.";
|
|
$from = "noreply@ilink.com";
|
|
$headers = "From:" . $from;
|
|
$name = "ilink";
|
|
mail($email, $subject, $message, $headers);
|
|
// Start Sending SMS
|
|
$sms = $client->account->messages->create(
|
|
// the number we are sending to - Any phone number
|
|
"+24107300823",
|
|
array(
|
|
// Step 6: Change the 'From' number below to be a valid Twilio number
|
|
// that you've purchased
|
|
'from' => $sender_number,
|
|
|
|
|
|
// the sms body
|
|
'body' => $message
|
|
)
|
|
);
|