2013-11-30 6 views
0

Я пытаюсь запустить Twilio с помощью WAMP:Services_Twilio_HttpException для отправки SMS с помощью Twilio

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

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

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

ответ

3

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

Смежные вопросы