( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
include('Connections/videoondemand.php');
require("DbSql2.inc.php");
require("NewsSql2.inc.php");
$db = new NewsSQL;
//a class to handle database operations
ini_set('max_execution_time', 300000); //300 seconds = 5 minutes
error_reporting(1);
function downloadFile($url, $path)
{
$newfname = $path;
$file = fopen ($url, 'rb');
if ($file) {
$newf = fopen ($newfname, 'wb');
if ($newf) {
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8), 1024 * 8);
}
}
}
if ($file) {
fclose($file);
}
if ($newf) {
fclose($newf);
}
}
include("assets/fonts/google-fonts-v2.php");
$data = json_decode($json , true);
//print_r($data);
$count = 0;
foreach ($data["fonts"] as $row) {
$count++;
$id = $row['id'];
$family = $row['family'];
$fullName = $row['fullName'];
$postScriptName = $row['postScriptName'];
$preview = $row['preview'];
$style = $row['style'];
$url = $row['url'];
$category = $row['category'];
echo "<br>";
echo "<br>";
if($count > 0 && $count < 5700) {
$path = $url;
$file_name = basename($path);
$destinationFilePath = '/var/www/html/assets/gfonts2/' . $file_name;
if (!file_exists($destinationFilePath)) {
downloadFile($url, $destinationFilePath);
echo "downloaded".$file_name."<br>";
}
}
}