我正在尝试使用WAMP运行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扩展名是必需的但当前未启用。有关详细信息,请参阅第64行的D:\ Ankita \ wamp \ www \ twilio-php-latest \ Services \ Twilio.php中的http://php.net/manual/en/book.openssl.php'
谁能告诉我为什么会这样?
答案 0 :(得分:3)
好的,我设法通过取消注释php.ini文件中的行extension = php_openssl.dll来解决它