Services_Twilio_HttpException для отправки SMS с помощью twilio

Я пытаюсь запустить twilio с помощью WAMP:

Я только что взял код из учебника:

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

<?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 требуется, но в настоящее время не включено». Для получения дополнительной информации см. http://php.net/manual/en/book.openssl.php' в D:\Ankita\wamp\www\twilio-php-latest\Services\Twilio.php в строке 64

Кто-нибудь может сказать мне, почему это происходит?


person gazubi    schedule 30.11.2013    source источник


Ответы (1)


Хорошо, мне удалось решить эту проблему, раскомментировав строку extension=php_openssl.dll внутри файла php.ini.

person gazubi    schedule 23.12.2013