我有ios的消息应用程序,我希望使用twilio短信服务。我需要为此目的创建一个Web服务,但我收到一个错误:
Class' TwilioRestClient'找不到
任何人都可以帮助我吗
<?php
include_once "config.php";
require "twilio-php-latest/Services/Twilio.php";
$phoneno = $_REQUEST['phoneno'];
$selectlist = mysql_query("select * from employee where phoneno = '".$phoneno."'");
//set authentication
$AccountSid = '***';
$Authtoken = '***';
//message values
$data = array(
'From' => "***",
'To' => "$phoneno",
'Body' => "Hello, Your guest has arrived at the reception"
);
//new twilio rest client
$client = new Services_Twilio($AccountSid,$AuthToken);
$response = $client -> request("/$ApiVersion/AccountSid/SMS/Messages","POST",$data);
//check response for success or failure
if($response->IsError)
{
while($post = mysql_fetch_assoc($selectlist))
{
$data[] = $post;
}
header('Content-type: application/json');
echo stripslashes(json_encode(array('error reading sms'=>'$response->ErrorMessage')));//echo" error reading sms: ($response->ErrorMessage)";
}
else
{
header('Content-type: application/json');
echo stripslashes(json_encode(array('sent message'=>'ResponseXml->Sid')));//echo "sent message: ($response->ResponseXml->Sid)";
}
?>