在 Twilio 失败,新用户 [英] Failing at Twilio, new user

查看:26
本文介绍了在 Twilio 失败,新用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近承担了制作一个快速而肮脏的静态 html 页面的任务,该页面将使用 php 访问 Twilio 并使用 SMS 回复.我是 Twilio 的新手,一直在学习本教程:

I've recently taken on the task of making a quick and dirty static html page that will use php to access Twilio and reply with an SMS. I am new to Twilio, and was following this tutorial:

http://www.twilio.com/docs/quickstart/php/sms/sending-via-rest

失败后,我回去检查我是否在下载 php zip 并阅读了 Twilio 网站安装页面中的内容后跳过了任何步骤,但即使这样也没有意义,因为我从来没有放牧PEAR 并简单地下载了 php zip 文件并开始工作.

When that failed I went back to check if I had skipped any steps after downloading the php zip and read over the content in the install page of the Twilio website, but even that didn't make sense, since I have never herd of PEAR and simply downloaded the php zip file and started working.

现在我不确定我是否正确安装了 Twilio(如上所述,我刚刚下载了 zip 文件夹),但我知道我按照本网站的建议更改了 Wamp 的根目录:

Now I am not sure if I even installed Twilio correctly(as stated above I just downloaded the zip folder), but I do know I changed the root directory for Wamp as advised by this site:

http://www.ruifeio.com/2011/01/30/change-the-www-root-directory-on-wampserver/

因为所有教程都说可以使用 WAMP,而且我的机器中已经有了它:

since all the tutorials said it was ok to use WAMP and because I had it already in my machine:

但是,即使进行了更改,我希望是正确的,我似乎也无法让 Twilio 向我发送文本.

However, even after making that change, correctly I hope, I can't seem to get Twilio to send me a text.

我的代码基本上是我上面列出的教程中的复制和粘贴作业,如下所示:

My code is basically a copy and paste job from the tutorial I've listed above, it looks as follows:

<?php 

require "C:\Users\Kevin\Marco Polo\\twilio-php-master\Services\Twilio.php";
$AccountSid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$AuthToken = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";

$client = new Services_Twilio($AccountSid, $AuthToken);

$people = array(
    "+13466033189" => "Kevin",
    "+16462805711" => "Loca",
    "+17188390403" => "Stefa",
    "+17183405728" => "Sweet Chocolate Man"
);

foreach($people as $number => $name){
    $sms = $client->account->sms_messages->create(
        "732-704-799",

        $number,

        "Hey $name, YOLO!!!! -Nick R. :P
        P.S. do not reply"
    );
    echo "Sent message to $name";
}
?>

编辑

在进行@Brainless Box 和@CaseySoftware 建议的更改后,我即将摆脱一个错误,只有三个错误

After making the changes suggest by @Brainless Box and @CaseySoftware I was about to get rid of one error and only have three

三个错误按时间顺序排列如下:

The three errors are, in chronological order, as follows:

Warning: file_get_contents(): ailed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\Users\Kevin\Marco Polo\twilio-php-master\Services\Twilio\HttpStream.php on line 61

Fatal error: Uncaught exception 'Services_Twilio_HttpStreamException' with message 'Unable to connect to service' in C:\Users\Kevin\Marco Polo\twilio-php-master\Services\Twilio\HttpStream.php on line 64

Services_Twilio_HttpStreamException: Unable to connect to service in C:\Users\Kevin\Marco Polo\twilio-php-master\Services\Twilio\HttpStream.php on line 64

我对此非常陌生,几乎不明白发生了什么,我哪里出错了,以及错误是在我的代码中还是在我的 Twilio 安装中.如果有人能帮我一把,那就太好了.

I am all very new to this and hardly understand what is going on and where I went wrong and whether the mistake is in my code or in my installation of Twilio. If someone can lend me a hand that would be great.

谢谢大家:)

推荐答案

您没有在 Wamp 配置中启用 SSL 扩展;要启用扩展,请转到您的 WAMP 目录(类似于 C:\path\to\wamp\bin\php\php#.#.#\php.ini)并取消注释 ;extension=php_openssl.dll.

You don't have the SSL extension enabled in your Wamp configuration; to enable the extension, go to your WAMP directory (something like C:\path\to\wamp\bin\php\php#.#.#\php.ini) and uncomment ;extension=php_openssl.dll.

之后一定要重启WAMP.

Be sure to restart WAMP after.

这篇关于在 Twilio 失败,新用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆