engineerKev
engineerKev

Reputation: 335

Failing at Twilio, new user

I've recently taken on the task of making a quick and dirty static html page that will use php to access Twilio and reply with an SMS. I am new to Twilio, and was following this tutorial:

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

When that failed I went back to check if I had skipped any steps after downloading the php zip and read over the content in the install page of the Twilio website, but even that didn't make sense, since I have never herd of PEAR and simply downloaded the php zip file and started working.

Now I am not sure if I even installed Twilio correctly(as stated above I just downloaded the zip folder), but I do know I changed the root directory for Wamp as advised by this site:

http://www.ruifeio.com/2011/01/30/change-the-www-root-directory-on-wampserver/

since all the tutorials said it was ok to use WAMP and because I had it already in my machine:

However, even after making that change, correctly I hope, I can't seem to get Twilio to send me a text.

My code is basically a copy and paste job from the tutorial I've listed above, it looks as follows:

<?php 

require "C:\Users\Kevin\Marco Polo\\twilio-php-master\Services\Twilio.php";
$AccountSid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$AuthToken = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";

$client = new Services_Twilio($AccountSid, $AuthToken);

$people = array(
    "+13466033189" => "Kevin",
    "+16462805711" => "Loca",
    "+17188390403" => "Stefa",
    "+17183405728" => "Sweet Chocolate Man"
);

foreach($people as $number => $name){
    $sms = $client->account->sms_messages->create(
        "732-704-799",

        $number,

        "Hey $name, YOLO!!!! -Nick R. :P
        P.S. do not reply"
    );
    echo "Sent message to $name";
}
?>

EDIT

After making the changes suggest by @Brainless Box and @CaseySoftware I was about to get rid of one error and only have three

The three errors are, in chronological order, as follows:

Warning: file_get_contents(): ailed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\Users\Kevin\Marco Polo\twilio-php-master\Services\Twilio\HttpStream.php on line 61

Fatal error: Uncaught exception 'Services_Twilio_HttpStreamException' with message 'Unable to connect to service' in C:\Users\Kevin\Marco Polo\twilio-php-master\Services\Twilio\HttpStream.php on line 64

Services_Twilio_HttpStreamException: Unable to connect to service in C:\Users\Kevin\Marco Polo\twilio-php-master\Services\Twilio\HttpStream.php on line 64

I am all very new to this and hardly understand what is going on and where I went wrong and whether the mistake is in my code or in my installation of Twilio. If someone can lend me a hand that would be great.

Thanks Everyone :)

Upvotes: 0

Views: 1268

Answers (1)

Brainless Box
Brainless Box

Reputation: 587

You don't have the SSL extension enabled in your Wamp configuration; to enable the extension, go to your WAMP directory (something like C:\path\to\wamp\bin\php\php#.#.#\php.ini) and uncomment ;extension=php_openssl.dll.

Be sure to restart WAMP after.

Upvotes: 2

Related Questions