<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
#[Route('/', name: 'home')]
public function index(): Response
{
return $this->render('home/index.html.twig', [
'title' => 'Головна сторінка',
]);
}
#[Route('/test', name: 'test')]
public function test(): Response
{
// $eic = '62Z0946795963998';
// $rahynok = '5300020186';
$rahynok = '5300018145';
$arr_apps_for_yuric = [
'sender' => 'loe',
'msg-type' => 'from-ns',
'msg-data' => [
'priority' => 0,
'ns_msg_id' => NULL,
'title' => 'Тестування!',
'receivers' => [],
],
];
// $arr_apps_for_yuric['msg-data']['receivers'][$eic][$rahynok] = 'Додаток оновлено! ' . date('Y-m-d H:i:s');
$arr_apps_for_yuric['msg-data']['receivers'][$rahynok] = 'Додаток оновлено! ' . date('Y-m-d H:i:s');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api-gate.inneti.net/kom-kom/api/create-notfication-actions');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_USERPWD, 'loe:GE2666Mh4maRa79iMs5igRPD');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr_apps_for_yuric));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
echo '<pre>';
print_r(json_decode($result, true));
echo '</pre>';
echo 111111111; die;
return $this->render('home/test.html.twig', [
'title' => 'Тестова сторінка',
]);
}
}