src/Controller/Home/HomeController.php line 43

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Home;
  3. use App\Repository\OrderRepository;
  4. use App\Traits\ApiOrderFieldNormalizerTrait;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. use Symfony\Component\Serializer\SerializerInterface;
  12. /**
  13.  * @Route("/", name="home")
  14.  */
  15. class HomeController extends AbstractController
  16. {
  17.     use ApiOrderFieldNormalizerTrait;
  18.     
  19.     public $session;
  20.     public $orderRepository;
  21.     public $serializer;
  22.     public $appUrl;
  23.     public function __construct(
  24.         SessionInterface $session,
  25.         OrderRepository $orderRepository,
  26.         SerializerInterface $serializer
  27.     )
  28.     {
  29.         $this->session $session;
  30.         $this->appUrl $_ENV['APP_URL'];
  31.         $this->orderRepository $orderRepository;
  32.         $this->serializer $serializer;
  33.     }
  34.     public function ssr(Request $request)
  35.     {
  36.         $appurl $_SERVER['APP_URL'];
  37.         $ssrurl $_SERVER['SSR_URL'];
  38.         $url $request->getUri();
  39.         $url str_replace($appurl$ssrurl$url);
  40.         $my_query_string http_build_query($request->query->all());
  41.         $curl curl_init($url);
  42.         curl_setopt($curlCURLOPT_HEADER1); // Include headers
  43.         curl_setopt($curlCURLOPT_RETURNTRANSFER1); // Return data as a string
  44.         // curl_setopt($curl, CURLOPT_PORT, 3000);
  45.         curl_setopt($curlCURLOPT_IPRESOLVECURL_IPRESOLVE_V4 );
  46.         $result curl_exec($curl);
  47.         $status_code curl_getinfo($curlCURLINFO_HTTP_CODE);
  48.         $content_type curl_getinfo($curlCURLINFO_CONTENT_TYPE);
  49.         $header_size curl_getinfo($curlCURLINFO_HEADER_SIZE);
  50.         $header substr($result0$header_size);
  51.         $body substr($result$header_size);
  52.         curl_close($curl);
  53.         // dd($result);
  54.         $response $this->render('home/ssr.html.twig', ['content' => $body]);
  55.         $response->headers->set('content-type'$content_type);
  56.         return $response;
  57.     }
  58.     
  59.     /**
  60.      * @Route("/deeplink", name="deepLink")
  61.      */
  62.     public function deepLink(Request $request)
  63.     {
  64.         // dd($request->query->get('link'));
  65.         return $this->redirect($request->query->get('link'));
  66.     }
  67.     /**
  68.      * @Route("", name="home")
  69.      */
  70.     public function home()
  71.     {
  72.         $token $this->isUserLogin();
  73.         $API_Name "v1/top/fortune/tellers";
  74.         $data $this->ApiGetMethod($API_Name);
  75.         dump($data);
  76.         return $this->render('home/index.html.twig', ['tellers' => $data'token' => $token]);
  77.     }
  78.     /**
  79.      * @Route("yorumu-oku/{id}", name="yorum-oku")
  80.      */
  81.     public function readAnswer($id)
  82.     {
  83.         $uuid $this->encryptor($id);
  84.         $order $this->orderRepository->findOneBy(['uuid' => $uuid'isDeleted' => false]);
  85.         if($order == NULL){
  86.             return $this->forward('App\Controller\Home\HomeController::p404');
  87.         }
  88.         $orderOwnerEmail $order->ownerEmail();
  89.         /** @var User $user */
  90.         $user $order->owner();
  91.         $serializedEntity json_decode($this->serializer->serialize(
  92.             $order,
  93.             'json',
  94.             ['groups' => ['order''price']]
  95.         ));
  96.         $normalizedEntity $this->normalizeOrders([$serializedEntity])[0];
  97.         return $this->render('home/reply.html.twig',[
  98.             'message' => 'Success',
  99.             'data' => $normalizedEntity,
  100.             'user' => $orderOwnerEmail,
  101.             'isReviewed' => $user->getIsReviewed(),
  102.             'invitedDiscount' => $user->getInvited() ? ($user->getInvited()->getInvetdUsage() ? null $user->getInvited()->getInvitedPercentage()) : null,
  103.             'error' => false,
  104.         ]);
  105.     }
  106.     /**
  107.      * @Route("register", name="register")
  108.      */
  109.     public function register()
  110.     {
  111.         return $this->render('home/account.html.twig');
  112.     }
  113.     /**
  114.      * @Route("login",name="login")
  115.      */
  116.     public function login()
  117.     {
  118.         return $this->render('home/login.html.twig');
  119.     }
  120.     /**
  121.      * @Route("logout",name="logout")
  122.      */
  123.     public function logout()
  124.     {
  125.         $this->session->remove("_token");
  126.     }
  127.     /**
  128.      * @Route("password/reset",name="password.reset")
  129.      */
  130.     public function resetPassword()
  131.     {
  132.         return $this->render('home/resetpassword.html.twig');
  133.     }
  134.     /**
  135.      * @Route("password/congrats",name="password/congrats")
  136.      */
  137.     public function PasswordUpdate()
  138.     {
  139.         return $this->render('home/congrats.html.twig');
  140.     }
  141.     /**
  142.      * @Route("kullanici-sozlesmesi",name="privacy")
  143.      */
  144.     public function Privacy()
  145.     {
  146.         $token $this->isUserLogin();
  147.         $curl curl_init();
  148.         curl_setopt_array($curl, array(
  149.             CURLOPT_URL => $this->appUrl "api/v1/static/content/kullanici",
  150.             CURLOPT_RETURNTRANSFER => true,
  151.             CURLOPT_ENCODING => "",
  152.             CURLOPT_MAXREDIRS => 10,
  153.             CURLOPT_TIMEOUT => 60,
  154.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  155.             CURLOPT_CUSTOMREQUEST => "GET",
  156.             CURLOPT_HTTPHEADER => array(
  157.                 "cache-control: no-cache",
  158.             ),
  159.         ));
  160.         $response curl_exec($curl);
  161.         $err curl_error($curl);
  162.         curl_close($curl);
  163.         if ($err) {
  164.             return $this->forward('App\Controller\Home\HomeController::p404');
  165.         } else {
  166.             $response json_decode($response);
  167.             dump($response);
  168.             return $this->render('home/privacy.html.twig',
  169.                 [
  170.                     'static' => $response->data,
  171.                     'token' => $token
  172.                 ]
  173.             );
  174.         }
  175.     }
  176.     /**
  177.      * @Route("gizlilik-sozlesmesi",name="agreement")
  178.      */
  179.     public function Agreement()
  180.     {
  181.         $token $this->isUserLogin();
  182.         $curl curl_init();
  183.         curl_setopt_array($curl, array(
  184.             CURLOPT_URL => $this->appUrl "api/v1/static/content/gizlilik",
  185.             CURLOPT_RETURNTRANSFER => true,
  186.             CURLOPT_ENCODING => "",
  187.             CURLOPT_MAXREDIRS => 10,
  188.             CURLOPT_TIMEOUT => 60,
  189.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  190.             CURLOPT_CUSTOMREQUEST => "GET",
  191.             CURLOPT_HTTPHEADER => array(
  192.                 "cache-control: no-cache",
  193.             ),
  194.         ));
  195.         $response curl_exec($curl);
  196.         $err curl_error($curl);
  197.         curl_close($curl);
  198.         if ($err) {
  199.             return $this->forward('App\Controller\Home\HomeController::p404');
  200.         } else {
  201.             $response json_decode($response);
  202.             return $this->render('home/agreement.html.twig',
  203.                 [
  204.                     'static' => $response->data,
  205.                     'token' => $token
  206.                 ]
  207.             );
  208.         }
  209.     }
  210.     /**
  211.      * @Route("kahve-fali-bakan-falcilar", name="kahve-fali-bakan-falcilar" , options={"utf8": true})
  212.      * @return Response
  213.      */
  214.     public function fortuneCategoryKahveFali()
  215.     {
  216.         $token $this->isUserLogin();
  217.         $data $this->getFortuneTellersBySlug("kahve-fali");
  218.         $desc $this->getFortuneCategories();
  219.         return $this->render('home/category.html.twig',
  220.             [
  221.                 'token' => $token,
  222.                 'tellers' => $data,
  223.                 'catName' => "Kahve Falı",
  224.                 'desc' => $desc,
  225.                 'keywords' => "Kahve falı bak, kahve falıma bakmak istiyorum, kafe falı, gerçek fal baktır, tece falı, kahve falı ne zaman aşık olucam, kahve falında her ÅŸey cıkar mı? Kahve falının incelikleri, gerçek kahve falı, Ã¼cretsiz kahve falı, Ã¼cretsiz",
  226.                 'metaDesc' => "Kahve falı bakan gerçek falcılar Falvefal.com’da! Telvelerin  anlamını merak ediyor musun? Hemen kahve falı baktır Ã§ok ÅŸaşıracaksın."
  227.             ]
  228.         );
  229.     }
  230.     /**
  231.      * @Route("tarot-fali-bakan-falcilar", name="tarot-fali-bakan-falcilar" , options={"utf8": true})
  232.      * @return Response
  233.      */
  234.     public function fortuneCategoryTarotFali()
  235.     {
  236.         $token $this->isUserLogin();
  237.         $data $this->getFortuneTellersBySlug("tarot-fali");
  238.         $desc $this->getFortuneCategories();
  239.         return $this->render('home/category.html.twig',
  240.             [
  241.                 'token' => $token,
  242.                 'tellers' => $data,
  243.                 'catName' => "Tarot Falı",
  244.                 'desc' => $desc,
  245.                 'keywords' => "tarot falı nasıl bakılır, tarot falı nedir? Tarot falı bakan falcılar, en iyi tarotcu, tarot falı cıkar mı, Tarot falı kartları nelerdir, tarot aÅŸk falı, tarot falı bakan en iyi falcılar, kart falı, kart falı bak, kart falı baktır, Ã¼cretsiz tarot, ne zaman evlenicem",
  246.                 'metaDesc' => "Tarot falı bakan gerçek falcılar Falvefal.com’da! Kartların anlamını ve geleceÄŸini merak ediyor musun?"
  247.             ]
  248.         );
  249.     }
  250.     /**
  251.      * @Route("katina-fali-bakan-falcilar", name="katina-fali-bakan-falcilar" , options={"utf8": true})
  252.      * @return Response
  253.      */
  254.     public function fortuneCategoryKatinaFali()
  255.     {
  256.         $token $this->isUserLogin();
  257.         $data $this->getFortuneTellersBySlug("katina-fali");
  258.         $desc $this->getFortuneCategories();
  259.         return $this->render('home/category.html.twig',
  260.             [
  261.                 'token' => $token,
  262.                 'tellers' => $data,
  263.                 'catName' => "Katina Falı",
  264.                 'desc' => $desc,
  265.                 'keywords' => "katina falı nasıl bakılır, Katina aÅŸk falı Ã§Ä±kar mı, Katina falı bakan falcılar en iyi falcılar falvefal’da, falvefal’da katina falı baktır. AÅŸk falı,gerçek fal baktır, katina kart falı, iiÅŸki açılımı kader açılımı falvefal katina falı bakan en iyi falcılar, para açılımı, ne zaman evlenicem katina, Ã¼cretsiz katina",
  266.                 'metaDesc' => "Katina aÅŸk falı bakan gerçek falcılar Falvefal.com’da! Katina kartlarının  anlamını merak ediyor musun? Hemen katina aÅŸk falı baktır Ã§ok ÅŸaşıracaksın."
  267.             ]
  268.         );
  269.     }
  270.     /**
  271.      * @Route("ruya-yorumu-bakan-falcilar", name="ruya-yorumu-bakan-falcilar" , options={"utf8": true})
  272.      * @return Response
  273.      */
  274.     public function fortuneCategoryRuyaYorumu()
  275.     {
  276.         $token $this->isUserLogin();
  277.         $data $this->getFortuneTellersBySlug("ruya-yorumu");
  278.         $desc $this->getFortuneCategories();
  279.         return $this->render('home/category.html.twig',
  280.             [
  281.                 'token' => $token,
  282.                 'tellers' => $data,
  283.                 'catName' => "Rüya Yorumu",
  284.                 'desc' => $desc,
  285.                 'keywords' => "rüya yorumu anlamı, riyada görmek ne demek, rüyada görmek ne anlama geliyor, rüya tabirleri, rüya falcısı, ruya yorumuna bak, rüya falım, rüya yorumum",
  286.                 'metaDesc' => "Rüya yorumu bakan gerçek falcılar Falvefal.com’da! Rüyalarının anlamını merak ediyor musun?"
  287.             ]
  288.         );
  289.     }
  290.     /**
  291.      * @Route("iliski-danismani-bakan-falcilar", name="iliski-danismani-bakan-falcilar" , options={"utf8": true})
  292.      * @return Response
  293.      */
  294.     public function fortuneCategoryIliskiDanismani()
  295.     {
  296.         $token $this->isUserLogin();
  297.         $data $this->getFortuneTellersBySlug("iliski-danismani");
  298.         $desc $this->getFortuneCategories();
  299.         return $this->render('home/category.html.twig',
  300.             [
  301.                 'token' => $token,
  302.                 'tellers' => $data,
  303.                 'catName' => "Ä°liÅŸki Danışmanı",
  304.                 'desc' => $desc,
  305.                 'keywords' => "Ä°liÅŸki danışmanı falcılar, mutlu bir iliÅŸki nasıl olmalı, sevgilimle nasıl barısırım, sevgilim beni seviyor mu,ask hayatım, sevgilim",
  306.                 'metaDesc' => "Ä°liÅŸki danışmanı bakan gerçek falcılar Falvefal.com’da! Ä°liÅŸkindeki sorunlaru hemen Ã§Ã¶zmek için danışmanlarımıza baÅŸvur, Ã§ok ÅŸaşıracaksın."
  307.             ]
  308.         );
  309.     }
  310.     /**
  311.      * @Route("el-fali-bakan-falcilar", name="el-fali-bakan-falcilar" , options={"utf8": true})
  312.      * @return Response
  313.      */
  314.     public function fortuneCategoryElFali()
  315.     {
  316.         $token $this->isUserLogin();
  317.         $data $this->getFortuneTellersBySlug("el-fali");
  318.         $desc $this->getFortuneCategories();
  319.         return $this->render('home/category.html.twig',
  320.             [
  321.                 'token' => $token,
  322.                 'tellers' => $data,
  323.                 'catName' => "El Falı",
  324.                 'desc' => $desc,
  325.                 'keywords' => "El falı nasıl bakılır, El falı bakan falcılar, El falı bakmanın kuralları, el falı bakmanın incelikleri, el falı Ã§Ä±kar mı, el falı hangi elle bakılır, el falı ile geleceÄŸini Ã¶ÄŸren, el falı bakan falcılar, elfalı fiyatları, en iyi el falı bakanfalcılar falvefal’da, el falı bak, el falı kaç lira, ne zaman evlenicem",
  326.                 'metaDesc' => "El falı bakan gerçek falcılar Falvefal.com’da! Elindeki Ã§izgilerin anlamını merak ediyor musun? Hemen el falı baktır Ã§ok ÅŸaşıracaksın."
  327.             ]
  328.         );
  329.     }
  330.     /**
  331.      * @Route("astroloji-bakan-falcilar", name="astroloji-bakan-falcilar" , options={"utf8": true})
  332.      * @return Response
  333.      */
  334.     public function fortuneCategoryAstroloji()
  335.     {
  336.         $token $this->isUserLogin();
  337.         $data $this->getFortuneTellersBySlug("astroloji");
  338.         $desc $this->getFortuneCategories();
  339.         return $this->render('home/category.html.twig',
  340.             [
  341.                 'token' => $token,
  342.                 'tellers' => $data,
  343.                 'catName' => "Astroloji Falı",
  344.                 'desc' => $desc,
  345.                 'keywords' => "astroloji falı, burç falı, 12 burç falı, burclar, astrologlar, en iyi astroloji falı bakan falcılar, burç uyumlarına bak, sevgilimle buç uyumu, yüselen burc nedir",
  346.                 'metaDesc' => "Astroloji falı yorumu bakan gerçek falcılar Falvefal.com’da! Burcunnun Ã¶zelliklerini ve geleceÄŸini merak ediyor musun?"
  347.             ]
  348.         );
  349.     }
  350.     /**
  351.      * @Route("falcilar", name="category.all" , options={"utf8": true})
  352.      * @return Response
  353.      */
  354.     public function fortuneCategoryAll()
  355.     {
  356.         $token $this->isUserLogin();
  357.         $data $this->getFortuneTellersAll();
  358.         dump($data);
  359.         return $this->render('home/category-all.html.twig',
  360.             [
  361.                 'token' => $token,
  362.                 'tellers' => $data,
  363.             ]
  364.         );
  365.     }
  366.     /**
  367.      * @Route("hakkimizda", name="about.us" , options={"utf8": true})
  368.      * @return Response
  369.      */
  370.     public function aboutUs()
  371.     {
  372.         $token $this->isUserLogin();
  373.         $desc $this->getFortuneCategories();
  374.         return $this->render('home/about.html.twig',
  375.             [
  376.                 'token' => $token,
  377.                 'desc' => $desc
  378.             ]
  379.         );
  380.     }
  381.     /**
  382.      * @Route("aradiginizi-bulamadik",name="p404")
  383.      */
  384.     public function p404()
  385.     {
  386.         $token $this->isUserLogin();
  387.         return $this->render('home/p404.html.twig', ['token' => $token]);
  388.     }
  389.     /**
  390.      * @Route("nasil-kullanirim",name="how-to")
  391.      */
  392.     public function howTo()
  393.     {
  394.         $token $this->isUserLogin();
  395.         return $this->render('home/how-to.html.twig', ['token' => $token]);
  396.     }
  397.     /**
  398.      * @Route("sikca-sorulan-sorular",name="faq")
  399.      */
  400.     public function Faqs()
  401.     {
  402.         $token $this->isUserLogin();
  403.         $API_Name "v1/faq";
  404.         $data $this->ApiGetMethod($API_Name);
  405.         return $this->render('home/faq.html.twig', ["faqs" => $data'token' => $token]);
  406.     }
  407.     private function ApiGetMethod($api_name)
  408.     {
  409.         $url $this->appUrl "api/" $api_name;
  410.         $ch curl_init();
  411.         curl_setopt($chCURLOPT_URL$url);
  412.         curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
  413.         curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
  414.         $data curl_exec($ch);
  415.         curl_close($ch);
  416.         $data json_decode($data);
  417.         return $data;
  418.     }
  419.     private function getFortuneTellersBySlug($slug)
  420.     {
  421.         $curl curl_init();
  422.         curl_setopt_array($curl, array(
  423.             CURLOPT_URL => $this->appUrl "api/v1/category/$slug/fortune/tellers",
  424.             CURLOPT_RETURNTRANSFER => true,
  425.             CURLOPT_ENCODING => "",
  426.             CURLOPT_MAXREDIRS => 10,
  427.             CURLOPT_TIMEOUT => 30,
  428.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  429.             CURLOPT_CUSTOMREQUEST => "GET",
  430.             CURLOPT_POSTFIELDS => "",
  431.             CURLOPT_HTTPHEADER => array(
  432.                 "cache-control: no-cache",
  433.                 "content-type: application/x-www-form-urlencoded"
  434.             ),
  435.         ));
  436.         $response curl_exec($curl);
  437.         $err curl_error($curl);
  438.         curl_close($curl);
  439.         if ($err) {
  440.             dump($err);
  441.             return false;
  442.         } else {
  443.             return json_decode($response);
  444.         }
  445.     }
  446.     private function getFortuneTellersAll()
  447.     {
  448.         $curl curl_init();
  449.         curl_setopt_array($curl, array(
  450.             CURLOPT_URL => $this->appUrl "api/v1/all/fortune/tellers",
  451.             CURLOPT_RETURNTRANSFER => true,
  452.             CURLOPT_ENCODING => "",
  453.             CURLOPT_MAXREDIRS => 10,
  454.             CURLOPT_TIMEOUT => 30,
  455.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  456.             CURLOPT_CUSTOMREQUEST => "GET",
  457.             CURLOPT_HTTPHEADER => array(
  458.                 "cache-control: no-cache",
  459.                 "postman-token: ec908936-9ebf-0ae6-23f2-b211cc207c0a"
  460.             ),
  461.         ));
  462.         $response curl_exec($curl);
  463.         $err curl_error($curl);
  464.         curl_close($curl);
  465.         if ($err) {
  466. //            dump($err);exit;
  467.             return false;
  468.         } else {
  469. //            dump($response);exit;
  470.             return json_decode($response);
  471.         }
  472.     }
  473.     private function getFortuneCategories()
  474.     {
  475.         $curl curl_init();
  476.         curl_setopt_array($curl, array(
  477.             CURLOPT_URL => $this->appUrl "api/v1/fortune/teller/categories",
  478.             CURLOPT_RETURNTRANSFER => true,
  479.             CURLOPT_ENCODING => "",
  480.             CURLOPT_MAXREDIRS => 10,
  481.             CURLOPT_TIMEOUT => 30,
  482.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  483.             CURLOPT_CUSTOMREQUEST => "GET",
  484.             CURLOPT_HTTPHEADER => array(
  485.                 "cache-control: no-cache",
  486.                 "postman-token: ec908936-9ebf-0ae6-23f2-b211cc207c0a"
  487.             ),
  488.         ));
  489.         $response curl_exec($curl);
  490.         $err curl_error($curl);
  491.         curl_close($curl);
  492.         if ($err) {
  493. //            dump($err);exit;
  494.             return false;
  495.         } else {
  496. //            dump($response);exit;
  497.             return json_decode($response);
  498.         }
  499.     }
  500.     /**
  501.      * @Route("login", name="login")
  502.      * @param Request $request
  503.      *
  504.      * @return JsonResponse
  505.      */
  506.     public function loginForm(Request $request): JsonResponse
  507.     {
  508.         $process $request->request->get('process'false);
  509.         if ($process) {
  510. //            var_dump($process);
  511.         } else {
  512.             $errorArray = array(
  513.                 'error' => true
  514.             );
  515.             return new JsonResponse($errorArray);
  516.         }
  517.         $email $request->request->get('loginemail');
  518.         $password $request->request->get('loginpassword');
  519.         $endpoint_url $this->appUrl "api/token/get";
  520.         // Sets our destination URL
  521. // Creates our data array that we want to post to the endpoint
  522.         $data_to_post = [
  523.             'email' => $email,
  524.             'password' => $password,
  525.         ];
  526. // Sets our options array so we can assign them all at once
  527.         $options = [
  528.             CURLOPT_URL => $endpoint_url,
  529.             CURLOPT_POST => true,
  530.             CURLOPT_POSTFIELDS => $data_to_post,
  531.         ];
  532. // Initiates the cURL object
  533.         $curl curl_init();
  534. // Assigns our options
  535.         curl_setopt_array($curl$options);
  536.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  537. // Executes the cURL POST
  538.         $results curl_exec($curl);
  539. // Be kind, tidy up!
  540.         curl_close($curl);
  541.         $decodedResult json_decode($resultstrue);
  542.         if (isset($decodedResult['token'])) {
  543.             $this->session->set("_token"$decodedResult['token']);
  544.             $this->session->set("_email"$decodedResult['data']['email']);
  545.         }
  546.         return new JsonResponse($decodedResult);
  547.     }
  548.     private function postAPICall($endPoint$dataToPost = array())
  549.     {
  550.         $endpoint_url $this->appUrl "{$endPoint}";
  551.         // Sets our destination URL
  552. // Creates our data array that we want to post to the endpoint
  553.         $data_to_post $dataToPost;
  554. // Sets our options array so we can assign them all at once
  555.         $options = [
  556.             CURLOPT_URL => $endpoint_url,
  557.             CURLOPT_POST => true,
  558.             CURLOPT_POSTFIELDS => $data_to_post,
  559.         ];
  560. // Initiates the cURL object
  561.         $curl curl_init();
  562. // Assigns our options
  563.         curl_setopt_array($curl$options);
  564.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  565. // Executes the cURL POST
  566.         $results curl_exec($curl);
  567. // Be kind, tidy up!
  568.         curl_close($curl);
  569.         return $results;
  570.     }
  571.     private function isUserLogin()
  572.     {
  573.         $loginStatus $this->session->get('_token');
  574.         if ($loginStatus == null) {
  575.             return false;
  576.         } else {
  577.             return $loginStatus;
  578.         }
  579.     }
  580.     private function encryptor($string)
  581.     {
  582.         $output false;
  583.         $encrypt_method "AES-256-CBC";
  584.         //pls set your unique hashing key
  585.         $secret_key 'app';
  586.         $secret_iv 'flox';
  587.         // hash
  588.         $key hash('sha256'$secret_key);
  589.         // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
  590.         $iv substr(hash('sha256'$secret_iv), 016);
  591.         //decrypt the given text/string/number
  592.         $output openssl_decrypt(base64_decode($string), $encrypt_method$key0$iv);
  593.         return $output;
  594.     }
  595. }