403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.exchange1c/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.exchange1c/lib/Sender.php
<?php
namespace Wbs24\Exchange1c;

class Sender implements Interfaces\Sender
{
    use Exception;

    protected $wrappers;
    protected $Settings;

    protected $moduleSettings;

    public function __construct($objects = [])
    {
        $this->wrappers = new Wrappers($objects);
        $this->Settings = $objects['Settings'] ?? new Settings($objects);

        $this->moduleSettings = $this->Settings->get();
    }

    public function sendOrders(array $orders)
    {
        $url = $this->moduleSettings['1cUrlForOrders'] ?? false;
        if ($url && $orders) {
            $this->sendRequest($url, json_encode(['orders' => $orders]));
        }
    }

    public function sendOrderStatuses(array $orderStatuses)
    {
        $url = $this->moduleSettings['1cUrlForStatuses'] ?? false;
        if ($url && $orderStatuses) {
            $this->sendRequest($url, json_encode(['orderStatuses' => $orderStatuses]));
        }
    }

    protected function sendRequest(string $url, string $data = '', array $headers = [])
    {
        if ($this->moduleSettings['debug']) {
            $this->createReport('send.log', [$url, $data]);
        }

        $curl = $this->wrappers->Curl->curl_init($url);
        if (strpos($url, 'https:') !== false) {
            $this->wrappers->Curl->curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            $this->wrappers->Curl->curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        }
        $this->wrappers->Curl->curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        $this->wrappers->Curl->curl_setopt($curl, CURLOPT_HEADER, false);
        $this->wrappers->Curl->curl_setopt($curl, CURLOPT_POST, true);
        $this->wrappers->Curl->curl_setopt($curl, CURLOPT_POSTFIELDS, $data ?: '');
        $this->wrappers->Curl->curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        $this->wrappers->Curl->curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $response = $this->wrappers->Curl->curl_exec($curl);
        $error = $this->wrappers->Curl->curl_error($curl);
        if ($error) {
            $this->createReport('error.log', $error);
        }
        $this->wrappers->Curl->curl_close($curl);

        return $response;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit