gazubi
gazubi

Reputation: 561

Services_Twilio_HttpException for sending SMS using twilio

I am trying to run twilio using WAMP:

I just picked up the code from the tutorial:

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";
    }

The error I am getting is Fatal error: Uncaught exception 'Services_Twilio_HttpException' with message 'The OpenSSL extension is required but not currently enabled. For more information, see http://php.net/manual/en/book.openssl.php' in D:\Ankita\wamp\www\twilio-php-latest\Services\Twilio.php on line 64

Can anyone tell me why this is happening?

Upvotes: 0

Views: 1072

Answers (1)

gazubi
gazubi

Reputation: 561

Ok i managed to solve it by uncommenting the line extension=php_openssl.dll inside php.ini file

Upvotes: 3

Related Questions