laden und in datenbank ablegen
This commit is contained in:
parent
f090308cf4
commit
e2401fefbe
16
fetch.php
16
fetch.php
@ -1,3 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
$inhalt = file_get_contents("https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Fallzahlen.html");
|
include "config.php";
|
||||||
var_dump($inhalt);
|
|
||||||
|
$sql = "SELECT id, title, link FROM sites WHERE active=1";
|
||||||
|
$stmt = $pdo->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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user