<?php  ini_set('display_errors', 0); require_once("../includes/functions.php");  $db = new SQLite3('./.db.db'); $resT = $db->querySingle('SELECT type FROM type WHERE id=1');  if ($resT == "rt") { rt_(); } if ($resT == "ua") { ua_(); }  function ua_(){ $db = new SQLite3('./.db.db'); $imgs = $db->query('SELECT * FROM ads'); $rows = $db->query("SELECT COUNT(*) as count FROM ads"); $row = $rows->fetchArray(); $numRows = $row['count'];  while ($img = $imgs -> fetchArray(SQLITE3_ASSOC)) { $data[]=array( "id"=>"{$img['id']}", "title"=>"{$img['title']}", "type"=>"image", "link"=>"", "description"=>"FTG", "orderby"=>"0", "position"=>"horizontal", "extension"=>"{$img['extension']}", "createdon"=>"{$img['createdon']}", "path"=>"{$img['path']}", "orignal"=>"{$img['path']}", "thumbpath"=>"{$img['path']}" ); } $jdata = json_encode($data);  echo "{	\"result\":\"success\", \"data\":{ \"vertical\":{ \"adds\": $jdata, \"count\": $numRows } } }"; }  function rt_(){ libxml_use_internal_errors(true); $page = file_get_contents('https://www.rottentomatoes.com/browse/movies_in_theaters/?page=1'); $doc = new DOMDocument(); $doc->loadHTML($page); $divs = $doc->getElementsByTagName('img'); $id = 0; foreach($divs as $div) { if ($div->getAttribute('slot') === 'image') { $img = urldecode($div->getAttribute('data-src')); if ($img != '') { $data[]=array( "id"=>"{$id}", "title"=>"FTG_{$id}", "type"=>"image", "link"=>"", "description"=>"FTG", "orderby"=>"0", "position"=>"horizontal", "extension"=>"png", "createdon"=>"2022-05-15 03:32:03", "path"=>"{$img}", "orignal"=>"{$img}", "thumbpath"=>"{$img}" ); } } $id++; }   $jdata = json_encode($data);  echo "{	\"result\":\"success\", \"data\":{ \"vertical\":{ \"adds\": $jdata, \"count\": 5 } } }"; }