diff --git a/php/campus/cocal.db b/php/campus/cocal.db index 1453e19..e81ca4c 100644 Binary files a/php/campus/cocal.db and b/php/campus/cocal.db differ diff --git a/php/campus/cocal.php b/php/campus/cocal.php index d59344f..9b287b0 100644 --- a/php/campus/cocal.php +++ b/php/campus/cocal.php @@ -1,13 +1,13 @@ Geb.udeanschrift<\/td>([^<]*)<\/td>/", $response, $matches); + preg_match("/H.rsaalgruppe<\/td>(?P[^<]*)<\/td>/", $response, $matches); + preg_match("/Geb.udeanschrift<\/td>(?P
[^<]*)<\/td>/", $response, $matches); + preg_match("/Geb.udebezeichnung<\/td>(?P[^<]*)<\/td>/", $response, $matches); + preg_match("/Geb.udenummer<\/td>(?P[^<]*)<\/td>/", $response, $matches); + preg_match("/Raumname<\/td>(?P[^<]*)<\/td>/", $response, $matches); + preg_match("/Raumnummer<\/td>(?P[^<]*)<\/td>/", $response, $matches); + preg_match("/Geschoss<\/td>(?P[^<]*)<\/td>/", $response, $matches); - return ($r > 0) ? $matches[1] : false; + foreach ($matches as $key => $value) { + if (is_numeric($key) unset($matches[$key]); + } + + array_walk($matches, function ($value) { + return preg_replace('/[ ]{2,}/sm', ' ', utf8_encode($value)); + }); + + return (count($matches['address']) ? $matches : false; } function error() { @@ -182,11 +205,13 @@ if (isset($matrnr) && isset($passwd)) { $address = get_address($db, $room); if ($address === false) { - $address = preg_replace('/[ ]{2,}/sm', ' ', utf8_encode(crawl_address($room))); + $crawled = crawl_address($room); set_address($db, $room, $address); - $crawled = true; } - $value = $address . ', Aachen'; + + if ($address) { + $value = $address['address'] . ', Aachen'; + } break; case 'DESCRIPTION':