Skip to main content
added 238 characters in body
Source Link
Bilal Usean
  • 10.1k
  • 14
  • 75
  • 123

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.

  1. 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)?

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.

  1. 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)

Where could I copy the twilio-php-master (php libreary)?

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.

  1. 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)?

added 582 characters in body
Source Link
Bilal Usean
  • 10.1k
  • 14
  • 75
  • 123

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.

  1. 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 send-sms.phpObserver Class location but it is not work.

what is the right way to move core php file to magento 2 way?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)

Where could I copy the twilio-php-master (php libreary)?

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.

  1. 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 send-sms.php location but it is not work.

what is the right way to move core php file to magento 2 way?

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.

  1. 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)

Where could I copy the twilio-php-master (php libreary)?

edited body
Source Link
Bilal Usean
  • 10.1k
  • 14
  • 75
  • 123

My requirement inis 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.

  1. 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 send-sms.php location but it is not work.

what is the right way to move core php file to magento 2 way?

My requirement in 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.

  1. 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 send-sms.php location but it is not work.

what is the right way to move core php file to magento 2 way?

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.

  1. 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 send-sms.php location but it is not work.

what is the right way to move core php file to magento 2 way?

deleted 6 characters in body
Source Link
Bilal Usean
  • 10.1k
  • 14
  • 75
  • 123
Loading
Source Link
Bilal Usean
  • 10.1k
  • 14
  • 75
  • 123
Loading