Skip to content

Instantly share code, notes, and snippets.

@nyom
Created March 1, 2011 18:12
Show Gist options
  • Save nyom/849573 to your computer and use it in GitHub Desktop.
Save nyom/849573 to your computer and use it in GitHub Desktop.
<?php
$aktuelles_script = 'ba-dresden';
// Script created by Nur-E-Alam Khan
// Email: porosh@msn.com (Dhaka, Bangladesh)
$url ="http://www.ba-dresden.de/index2.php?menu=5";
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookie.txt");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "matrikelnr=______&passwort=_______");
ob_start(); // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
unset($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
curl_setopt($ch, CURLOPT_URL,"http://www.ba-dresden.de/index2.php?menu=5&item=20");
$buf2 = curl_exec ($ch);
curl_close ($ch);
$html = html_entity_decode(htmlentities($buf2));
// Einträge aus den News ziehen und formatiert wiedergeben
$ret = preg_match_all("/<td width=\"60\" class=\"line.*.\">(.+)<td width=\"15\"class=\"line.*.\">/siU", $html, $events);
foreach($events[1] as $event) {
//print_r ($event);
$html = $event;
$ret = preg_match_all("/(.+)<\/td><td width=\"90\" class=\"line.*.\">(.+)<\/td><td class=\"line.*.\">(.+)<\/td>" .// auslesen in data1-3 datum,person,inhalt
"/siU", $html, $data, PREG_SET_ORDER);
$content = $data[0][3];
$date = $data[0][2];
$name = $data[0][1];
echo $name . "<br />" . $date . "<br />" . $content . "<br /><hr /><br />";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment