Twilio PHP开始:“给我发消息”返回错误

时间:2016-10-09 09:36:22

标签: php twilio

我正在尝试使用Twilio PHP启动发送我的第一条消息,但它返回以下错误:“将请求发送到服务器时出错”

有人知道这意味着什么吗?

我把测试凭据和我刚刚在Twilio上设置的电话号码。并升级了我的帐户,因此我不知道问题可能来自哪里......

更新

我在谈论这个项目:https://github.com/Beans0063/starter-php

1 个答案:

答案 0 :(得分:1)

该回购在一年内没有更新。最好尝试从头开始发送消息,并确保使用最新版本的PHP library

您需要发送消息的代码:

https://www.twilio.com/docs/guides/sms/how-to-send-sms-messages-in-php

<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACfe6807be04581521240f555c6314c8bc";
$token = "your_auth_token";
$client = new Client($sid, $token);

$client->messages->create(
    '+15558675309',
    array(
        'from' => '+15017250604',
        'body' => "This is the ship that made the Kessel Run in fourteen parsecs?"
    )
);