-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix_pagenumbers.php
38 lines (24 loc) · 1.08 KB
/
fix_pagenumbers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once("configuration.php");
header("Content-Type: text/plain");
$dataresult = $dataconnection->query("SELECT paperID, paperBrand, pageCount FROM papers");
ob_start();
if ($dataresult->num_rows > 0)
{
while($paperData = $dataresult->fetch_assoc())
{
if ($paperData["pageCount"] > 0)
{
continue;
}
$json_file = file_get_contents('http://device.e-pages.dk/market/get_item.php?apiversion=4&model=android&customer=' . $paperData["paperBrand"] . '&catalog=' . $paperData["paperID"]);
$pdat = json_decode($json_file);
$pageCount = $pdat->pages;
$dataconnection->query("UPDATE papers SET pageCount = '" . $pageCount . "' WHERE paperBrand = '" . $paperData["paperBrand"] . "' AND paperID = '" . $paperData["paperID"] . "';");
echo "Updated pageCount on " . $paperData["paperBrand"] . " #" . $paperData["paperID"] . "\r\n";
ob_flush();
//$dataconnection->query("UPDATE papers SET pageCount = '" . $pageCount . "' WHERE paperBrand = '" . $paperData["paperBrand"] . "' AND paperID = '" . $paperData["paperID"] . "'");
}
}
ob_end_flush();
?>