From e2401fefbe454a4026152760d9562329eb970bb7 Mon Sep 17 00:00:00 2001 From: Goeran Heinemann Date: Wed, 4 Mar 2020 23:34:36 +0100 Subject: [PATCH] laden und in datenbank ablegen --- fetch.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fetch.php b/fetch.php index 3273047..7e7444a 100644 --- a/fetch.php +++ b/fetch.php @@ -1,3 +1,15 @@ query($sql); +$sites = $stmt->fetchAll(PDO::FETCH_ASSOC); +foreach ($sites as $site){ + echo 'fetching site: '.$site['title']."\n"; + $inhalt = file_get_contents($site['link']); + $sql = "INSERT INTO `scans`(`site`, `content`) VALUES (?, ?)"; + $stmt = $pdo->prepare($sql); + $stmt->bindParam(1, $site['id']); + $stmt->bindParam(2, $inhalt); + $stmt->execute(); +} \ No newline at end of file