<?php
$url = "http://www.xyz.html";
//den Quellcode von $url hohlen
function blablabla ($url) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.0)");
curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
curl_setopt ($ch, CURLOPT_HEADER, 0);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}
$content = blablabla($url);
//aus dem Quellcode "$content" die verschiedenen Inhalte heraussortieren
preg_match('!ords" content="(.*), !sUi',$content,$xxx1);
preg_match('!<h1 style(.*)>(.*)</h1!sUi',$content,$xxx2);
preg_match('!ze:100%">(.*)</p>!sUi',$content,$xxx3);
preg_match('!>jv,.., (.*), !sUi',$content,$xxx4);
preg_match('!>p>, (.*)( *)<!sUi',$content,$xxx5);
$ortdatum = explode(", ", $xxx6[1]);
//MySQL verbinden (mithilfe der datei connect.php)
include 'connect.php';
//die Variabeln neu benennen um in die DB einzulesen
$url = $url;
$xxx1 = $xxx1[2];
$xxx2 = $xxx2[1];
$xxx3 = $xxx3[1];
$xxx4 = $xxx4[1];
$xxx5 = $xxx5[1];
//Inhalte in die DB-Tabelle "bliblablu" einlesen
$eintrag = "INSERT INTO bliblablu (url, xxx1, xxx2, xxx3, xxx4, xxx5) VALUES ('$url', '$xxx1', '$xxx2', '$xxx3', '$xxx4', '$xxx5')";
$result = mysql_query($eintrag) or die(mysql_error());
?>