首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用twilio发送短信的Services_Twilio_HttpException

使用twilio发送短信的Services_Twilio_HttpException
EN

Stack Overflow用户
提问于 2013-11-30 14:59:09
回答 1查看 1K关注 0票数 0

我正在尝试使用WAMP运行twilio:

我只是从教程中拿起了代码:

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

代码语言:javascript
复制
<?php
    /* Send an SMS using Twilio. You can run this file 3 different ways:
     *
     * - Save it as sendnotifications.php and at the command line, run 
     *        php sendnotifications.php
     *
     * - Upload it to a web host and load mywebhost.com/sendnotifications.php 
     *   in a web browser.
     * - Download a local server like WAMP, MAMP or XAMPP. Point the web root 
     *   directory to the folder containing this file, and load 
     *   localhost:8888/sendnotifications.php in a web browser.
     */

    // Step 1: Download the Twilio-PHP library from twilio.com/docs/libraries, 
    // and move it into the folder containing this file.
    require "twilio-php-latest/Services/Twilio.php";

    // Step 2: set our AccountSid and AuthToken from www.twilio.com/user/account
    $AccountSid = "Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    $AuthToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

    // Step 3: instantiate a new Twilio Rest Client
    $client = new Services_Twilio($AccountSid, $AuthToken);

    // Step 4: make an array of people we know, to send them a message. 
    // Feel free to change/add your own phone number and name here.
    $people = array(
        "+1412xxxxxxx" => "Friend"
    );

    // Step 5: Loop over all our friends. $number is a phone number above, and 
    // $name is the name next to it
    foreach ($people as $number => $name) {

        $sms = $client->account->messages->sendMessage(

        // Step 6: Change the 'From' number below to be a valid Twilio number 
        // that you've purchased, or the (deprecated) Sandbox number
            "33x-xxx-xxxx", 

            // the number we are sending to - Any phone number
            $number,

            // the sms body
            "Hey $name, Monkey Party at 6PM. Bring Bananas! From Twilio team "
        );

        // Display a confirmation message on the screen
        echo "Sent message to $name";
    }

我收到的错误是致命错误:未捕获异常'Services_Twilio_HttpException‘,并显示消息’需要OpenSSL扩展但当前未启用。有关详细信息,请参阅D:\Ankita\wamp\www\twilio-php-latest\Services\Twilio.php第64行中的http://php.net/manual/en/book.openssl.php

谁能告诉我为什么会这样?

EN

回答 1

Stack Overflow用户

发布于 2013-12-23 10:33:11

好的,我设法解决了这个问题,方法是在php.ini文件中取消注释extension=php_openssl.dll行

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20297547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档