2013-01-28 2 views
1

Я пытаюсь использовать Twilio в приложении Wordpress, и это не сработало, но мой же код работает на другом сайте/сервере.Как отправить SMS-сообщение из Wordpress, используя Twilio?

Я добавил папку twilio-php и некоторый код PHP, чтобы вызвать его внутри корня wordpress. Я также добавил код, чтобы включить его в существующий PHP-код Wordpress, и я не могу понять, где проблема. Вы можете помочь?

<?php    

       require "twilio-php/Services/Twilio.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. 
       */ 
       // Include the PHP Twilio library. You need to download the library from 
       // twilio.com/docs/libraries, and move it into the folder containing this 
       // file. 


       // Set our AccountSid and AuthToken from twilio.com/user/account 
       $AccountSid = "********************"; 
       $AuthToken = "*********************"; 

       // Instantiate a new Twilio Rest Client 
       $client = new Services_Twilio($AccountSid, $AuthToken); 

       /* Your Twilio Number or Outgoing Caller ID */ 
       $from = '**********'; 

       // make an associative array of server admins. Feel free to change/add your 
       // own phone number and name here. 
       $people = array(
       "*********" => "******", 
       "**********" => "*********", 


       ); 

       // Iterate over all admins in the $people array. $to is the phone number, 
       // $name is the user's name 
       foreach ($people as $to => $name) { 
       // Send a new outgoing SMS */ 
       $body = "Hello this is a test message"; 
       $client->account->sms_messages->create($from, $to, $body); 
       echo "Sent message to $name"; 
       } 

?> 
+0

нет ответов ..... – wordpresrox

+0

хотя бы, если вы знаете, дайте мне aa liknk ............. – wordpresrox

+1

Эй! Извините, что у вас возникли проблемы с началом работы. Две вещи, которые были бы полезны. 1) Когда вы запускаете этот скрипт в своем браузере, что (если есть) является выходом на экране? 2) У вас есть доступ к журналам ошибок на вашем сервере? Если это так, вы можете вставить результаты здесь? Они помогут отладить проблему. –

ответ

0

я проверил журнал сервера и обратите внимание, что curel не установлен на сервере, то я установить и перезагрузить сервер, и теперь он работает отлично спасибо за огромную поддержку ... Кевин Берк Thanx: D

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