Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi,
I don't know if anybody tried that before. I want to use Twilio https://www.twilio.com/
to get a SMS each time a message is sent from my eMail form.

When I use the folllowing code:
Code: Select all
<cms:if k_success>
         <cms:php>
require __DIR__ . 'twilio-php-master/Twilio/autoload.php';
use Twilio\Rest\Client;
$sid = 'xxxxxx';
$token = 'xxxxxx';
$client = new Client($sid, $token);
$client->messages->create(
    '+xxxxxxxx',
    array(
        'from' => '+xxxxxxxx',
        'body' => "You received a message from TST. Check your eMails."
    )
);
</cms:php>


I get a 500 error. but if I use the exact same code on a regular php page, it works without problem

Did I miss something?
Thanks if you can help.
Paolo
@PaoloE:

Instead of:
Code: Select all
require __DIR__ . 'twilio-php-master/Twilio/autoload.php';


try using:
Code: Select all
<?php require_once( K_SITE_DIR.'twilio-php-master/Twilio/autoload.php' ); ?>

below the couch boilerplate.

I guess that should do the trick. I had a 500 Error with Mailchimp once, and this had solved the problem. Also make sure that the namespace being used is the one currently supported.
Code: Select all
use Twilio\Rest\Client;


Hope this helps!

Regards,
GenXCoders
Image
where innovation meets technology
That actually worked!

Thanks a lot.
Paolo
You are most Welcome!

Regards,
GenXCoders

P.S.: Can you please edit the title of your 1st post and make it as:
Code: Select all
[SOLVED]Twilio integration

I would be thankful. It actually helps others too!
Image
where innovation meets technology
4 posts Page 1 of 1

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 4 guests