вот моя проблема.
Я отправляю смс в свое приложение twilio и в соответствии с текстом в них, я хочу смс в ответ на другое число.
Ну, я начинаю с примера, мое приложение получает смс, отвечает на тот же номер с просьбой ввести несколько слов, но когда он получает ответ, никакое смс не приходит на другой номер (оба числа зарегистрированы в twilio в коде ниже я отредактировал последние номера)
Вот код
<?php
include 'Services/Twilio.php';
include 'config.php';
// make an associative array of callers we know, indexed by phone number
$people = array(
"+3932034091XX"=>"3934781415XX",
"+3934781415XX"=>"+3932034091XX",
"+14158675311"=>"Virgil",
"+14158675312"=>"Marcel");
$name=$people[$_REQUEST['From']];
function index($name){
$response = new Services_Twilio_Twiml();
$response->sms("Reply $name with one of the following keywords:
batteria, dog, pigeon, owl.");
echo $response;
}
function batteria($name){
$dest=$name;
$client = new Services_Twilio($TWILIO_ACCOUNT_SID, $TWILIO_AUTH_TOKEN);
$sms = $client->account->messages->create(
// Step 6: Change the 'From' number below to be a valid Twilio number
// that you've purchased, or the (deprecated) Sandbox number
$TWILIO_NUMBER,
// the number we are sending to - Any phone number
$dest,
// the sms body
"Hey Cambia la batteria!");
}
function dog(){
$response = new Services_Twilio_Twiml();
$response->sms("Dog. A domesticated carnivorous mammal that
typically has a long snout, an acute sense of smell, and a barking,
howling, or whining voice.");
echo $response;
}
function pigeon(){
$response = new Services_Twilio_Twiml();
$response->sms("Pigeon. A stout seed- or fruit-eating bird with
a small head, short legs, and a cooing voice, typically having gray and
white plumage.");
echo $response;
}
function owl(){
$response = new Services_Twilio_Twiml();
$response->sms("Owl. A nocturnal bird of prey with large
forward-facing eyes surrounded by facial disks, a hooked beak,
and typically a loud call.");
echo $response;
}
/* Read the contents of the 'Body' field of the Request. */
$body = $_REQUEST['Body'];
/* Remove formatting from $body until it is just lowercase
characters without punctuation or spaces. */
$result = preg_replace("/[^A-Za-z0-9]/u", " ", $body);
$result = trim($result);
$result = strtolower($result);
/* Router: Match the ‘Body’ field with index of keywords */
switch ($result) {
case 'batteria':
batteria($name);
break;
case 'dog':
dog();
break;
case 'pigeon':
pigeon();
break;
case 'owl':
owl();
break;
/* Optional: Add new routing logic above this line. */
default:
index($name);
}
?>
Спасибо всем
Задача ещё не решена.
Других решений пока нет …