I am new to the Opencart and MVC model, Opencart has an event system that helps to take some action or trigger before or after any function in Opencart like order confirm and order status update.
I want to trigger the external PHP script when the order is confirmed. The external PHP script is located in a different server and different domain. I need any solution or extension.
Link like http:xxxx.xxx/opencart/order_confirm.php
Trigger : catalog/model/checkout/order/addOrderHistory/after
Action : admin/controller/extension/module/test_app.php
Here is my code :
<?php
$url = 'http://xxxxx.com/xxxx/xxx/xx/order_confirm.php';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'OpenCart Two Factor Authentication');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
//curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_data));
$response = curl_exec($curl);