I spent a few days working this out, and here is what I have. It works, although it may be that there is a bit of redundancy in it since I started getting a headache trying different things lol. The main issue here is it will grab any URL in the string, and I cant do regex, so it would be best if it only grabbed links containing IMDB or variants. This code will check your DESCR and grab the link from it and put it in the DB under imdb when using that table, such as the OMDB mod
//Get any IMDB link from descr and load it into the DB under imdb
$timdb = SQL_Query_exec("SELECT descr FROM torrents WHERE id = $id");
$bang = mysqli_fetch_assoc($timdb);
$bang2 = implode(" ",$bang);
preg_match_all('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', $bang2, $matches);
$urls = $matches[0];
function array_map_callback($url)
{
return mysqli_real_escape_string($GLOBALS["DBconnector"], $url);
}
array_map('array_map_callback', $urls);
foreach ($urls as $url) {
SQL_Query_exec("UPDATE `torrents` SET `imdb`= '".$url."' WHERE id = $id");
}
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)