Задача стоит такая, после оформления заказа нужно отправлять информацию о заказе в виде json данных на другой сервак, в данный момент нашел контроллер который редиректит после всех валидаций на страницу успешного заказа (/catalog/controller/extension/payment/cod.php), вставляю туда код отправки и данные улетают, но вот встал вопрос, как сделать это правильно, может есть более правильные способы? Хотел бы узнать мнение специалистов. 
	
	
	
		
				
			
		PHP:
	
	class ControllerExtensionPaymentCod extends Controller {
    public function index() {
        return $this->load->view('extension/payment/cod');
    }
    public function confirm() {
        $json = array();
        
        if ($this->session->data['payment_method']['code'] == 'cod') {
            $this->load->model('checkout/order');
            $this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('payment_cod_order_status_id'));
            
            $this->load->model('account/order'); /*подключаем модель для получения информации о заказе*/
            
            $order_info = false;
            
            $order_info = $this->model_account_order->getOrderProducts($this->session->data['order_id']); /*order_info содержит информацию о заказе*/
            
            
            $url="http://site.by/metod.php?id=".json_encode($order_info);
            
            $curl = curl_init($url);
            
            curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
            
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            
            curl_setopt($curl, CURLOPT_HEADER, true);
            
            curl_setopt($curl, CURLOPT_NOBODY, true);
            
            curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
            
            $output = curl_exec($curl);
            
            curl_close($curl);
            
            $json['redirect'] = $this->url->link('checkout/success'); /*редирект на успешное оформление*/
        }
        
        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));       
    }
}