通过 twilio 和 php 进行语音通话:解析 autoload.php 中的错误

问题描述

我想使用 twilio PHP 库进行语音通话。 我从 Github 网站上提到的 twilio 链接下载了 PHP 帮助程序库。 然后我也使用了那里提供的 PHP 代码

    <?PHP
// Include the bundled autoload from the Twilio PHP Helper Library
require __DIR__ . '/twilio-PHP-main/src/Twilio/autoload.PHP';
use Twilio\Rest\Client;

// Your Account SID and Auth Token from twilio.com/console
$account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$auth_token = 'your_auth_token';
// In production,these should be environment variables. E.g.:
// $auth_token = $_ENV["TWILIO_ACCOUNT_SID"]

// A Twilio number you own with Voice capabilities
$twilio_number = "+15017122661";

// Where to make a voice call (your cell phone?)
$to_number = "+15558675310";

$client = new Client($account_sid,$auth_token);
$client->account->calls->create(
    $to_number,$twilio_number,array(
        "url" => "http://demo.twilio.com/docs/voice.xml"
    )
);

不幸的是我收到错误

解析错误:语法错误,意外的':',期待';'或第 61 行 /users/USER/www/twilio/twilio-PHP-main/src/Twilio/autoload.PHP 中的“{”。

我认为它们不会是库中的错误,并且自己无法找到或解决它。有人有想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)