php - 通过 twilio 和 php 进行语音通话:autoload.php 中的解析错误
问题描述
我想使用 twilio php 库进行语音通话。我从twilio网站上提到的Github链接下载了 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"
)
);
不幸的是,我收到了错误
解析错误:语法错误,意外 ':',期待 ';' 或 '{' 在 /users/USER/www/twilio/twilio-php-main/src/Twilio/autoload.php 第 61 行。
我认为他们不可能是图书馆中的错误,并且自己无法找到或解决它。有人有想法吗?
解决方案
推荐阅读
- python-3.x - 我需要使用 groupby 将数据框更改为另一个数据框
- python - 如何在 qt-designer 中创建浮点数列表
- flutter - 将变量从另一个类的状态传递给另一个类
- c++ - 用 C++ 制作菜单 (OOP)
- mysql - MySQL 在任何情况下都包含一个列,即使它也是 JOIN 子句的一部分
- r - R中系数二阶多项式的解释
- ocaml - 是否可以调试 Menhir 词法分析器?
- credential-providers - 哪些用户被传递到 ICredentialProviderSetUserArray.SetUserArray?
- javascript - Javascript Regex 在两个单词中多次搜索
- python - 将列表附加到数据框并添加计数