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