My requirement is sending sms while place order button triggered.
1) Locally I have use one predefined sms gateway server
I receive message When I run http://localhost/send-sms.php
, its not a magento way its fully core php.
2) I have set one event/observer when place order get trigger
I could try with copy the send-sms.php content to observer execute method, also copy the php library to the same Observer Class location but it is not work.
Observer class execute method
public function execute(\Magento\Framework\Event\Observer $observer)
{
require "twilio-php-master/Services/Twilio.php";
$AccountSid = "XXXXXXXXXXXXXXXXXXX";
$AuthToken = "XXXXXXXXXXXXXXXXXXXX";
$client = new Services_Twilio($AccountSid, $AuthToken);
$message = $client->account->messages->create(array(
"From" => "YYYYYYYYY",
"To" => "YYYYYYYYYY",
"Body" => "Test message!",
));
echo "Sent message {$message->sid}";
}
problem is magento get not recognize require URL. (first line of the execute method)
require 'twilio-php-master/Services/Twilio.php';
$client = new Services_Twilio($AccountSid, $AuthToken);
Services_Twilio class defined in Twilio.php, localy its work when I move to magento 2. I stuck with this two lines.
Where could I copy the twilio-php-master (php libreary)?