0

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 :)

engineerKev
  • 335
  • 5
  • 22

1 Answers1

2

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.

Brainless Box
  • 587
  • 9
  • 16
  • I will go ahead and give this a shot, thanks. I will post any updates or other issues as they arise. Thanks for the help. Finally, is the php_openssl.dll issue the only thing messing up my connection? – engineerKev Aug 16 '13 at 01:12
  • I believe that's all it should take. It's detailed here too: http://stackoverflow.com/a/7123591/41752 – CaseySoftware Aug 16 '13 at 01:15
  • Brainless Box your suggestion helped but there seems to be a bigger issue here, I have a hunch that it may have to do with my Twilio setup though @CaseySoftware, thanks for the link I am looking over the discussion now and trying the suggestions they recommend, please look at my edit and let me know what you think. – engineerKev Aug 16 '13 at 03:16