Update :3
This commit is contained in:
parent
59964add4a
commit
41a9a19187
41
README.md
41
README.md
|
@ -46,7 +46,7 @@ Station validieren - validate()
|
||||||
|
|
||||||
| Name | Typ | Beschreibung | Wird benötigt |
|
| Name | Typ | Beschreibung | Wird benötigt |
|
||||||
| ----- | ------ | --------------------------- | ------------- |
|
| ----- | ------ | --------------------------- | ------------- |
|
||||||
| value | string | Gültiger Name der Station | X |
|
| value | string | Gültiger Name der Station | X |
|
||||||
| id | int | Irgend eine ÖBB Stations ID | |
|
| id | int | Irgend eine ÖBB Stations ID | |
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ Verbindung suchen - get()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Details einer Verbindung - getDetails
|
Details einer Verbindung - getDetails()
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
**Wissenwertes**
|
**Wissenwertes**
|
||||||
|
@ -103,8 +103,41 @@ Details einer Verbindung - getDetails
|
||||||
| ---- | --- | -------------------------------------------- | ----------------- |
|
| ---- | --- | -------------------------------------------- | ----------------- |
|
||||||
| id | int | Index der spezifischen Verbindung. Siehe get | X |
|
| id | int | Index der spezifischen Verbindung. Siehe get | X |
|
||||||
|
|
||||||
|
**Rückgabewerte**
|
||||||
|
|
||||||
|
| Array | Name | Typ | Beschreibung | Beschreibung |
|
||||||
|
| ----- | ----------- | --- | ------------ | ------------ |
|
||||||
|
| start | | | | |
|
||||||
|
| | station | | | |
|
||||||
|
| | time | | | |
|
||||||
|
| | plattform | | | |
|
||||||
|
| | date | | | |
|
||||||
|
| | prognose | | | |
|
||||||
|
| | station | | | |
|
||||||
|
| end | | | | |
|
||||||
|
| | time | | | |
|
||||||
|
| | plattform | | | |
|
||||||
|
| | date | | | |
|
||||||
|
| | prognose | | | |
|
||||||
|
| data | | | | |
|
||||||
|
|
||||||
|
start
|
||||||
|
station (string) Name der Einstiegs Station
|
||||||
|
time (string) Abfahrtszeit von der Station
|
||||||
|
plattform (string) Bahnsteig an der Station
|
||||||
|
date (string) Abfahrtsdatum
|
||||||
|
prognose (string) Aktuelle Zeit, if n.a = string(0)
|
||||||
|
end
|
||||||
|
station (string) Name der Ausstiegs Station
|
||||||
|
time (string) Ankunftszeit an der Station
|
||||||
|
plattform (string) Bahnsteig an der Station
|
||||||
|
date (string) Ankunftsdatum
|
||||||
|
prognose (string) Aktuelle Zeit, if n.a = string(0)
|
||||||
|
data
|
||||||
|
productName (string) Produktname, z.B RJ, ICE, BUS
|
||||||
|
productImg (string) Dazugehöriges Bild zum Produkt oebb.at
|
||||||
|
productUrl (string) Übersicht für die Linie. NULL Bug
|
||||||
|
duration (string) Fahrzeit der Verbindung
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
require_once 'phpquery/phpQuery/phpQuery.php';
|
require_once 'phpquery/phpQuery/phpQuery.php';
|
||||||
|
|
||||||
class oebbApi {
|
class oebbApi {
|
||||||
|
|
||||||
protected $i = 0;
|
protected $i = 0;
|
||||||
protected $data = array();
|
protected $data = array();
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
session_start();
|
session_start();
|
||||||
|
$_SESSION["oebbApi"]["get"] = false;
|
||||||
|
$_SESSION["oebbApi"]["getDetails"] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($departure, $arrival, $amount, $date = null, $time = null, $timeMode = false) {
|
public function get($departure, $arrival, $amount, $date = null, $time = null, $timeMode = false) {
|
||||||
|
@ -52,10 +53,14 @@ class oebbApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_SESSION["oebbApi"] = $this->data;
|
$_SESSION["oebbApi"] = $this->data;
|
||||||
|
$_SESSION["oebbApi"]["get"] = true;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCoords() {
|
public function getCoords() {
|
||||||
|
if($_SESSION["oebbApi"]["getDetails"] == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$details = $_SESSION["oebbApi"]["detail"];
|
$details = $_SESSION["oebbApi"]["detail"];
|
||||||
$returnArray = array();
|
$returnArray = array();
|
||||||
foreach ($details AS $detail) {
|
foreach ($details AS $detail) {
|
||||||
|
@ -131,6 +136,9 @@ class oebbApi {
|
||||||
if ($index > count($_SESSION["oebbApi"])) {
|
if ($index > count($_SESSION["oebbApi"])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if($_SESSION["oebbApi"]["get"] == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->loadUrl($_SESSION["oebbApi"][$index]["changesLink"]);
|
$this->loadUrl($_SESSION["oebbApi"][$index]["changesLink"]);
|
||||||
|
|
||||||
|
@ -165,6 +173,9 @@ class oebbApi {
|
||||||
$startPlattform =
|
$startPlattform =
|
||||||
pq('.intermediateSection .platform:eq(' . $i . ')')->text();
|
pq('.intermediateSection .platform:eq(' . $i . ')')->text();
|
||||||
|
|
||||||
|
$startPrognose =
|
||||||
|
pq('.intermediateSection .realTime:eq(' . $i . ')')->text();
|
||||||
|
|
||||||
$productName =
|
$productName =
|
||||||
pq('.intermediateSection img.product:eq(' . $j . ')')->attr("alt");
|
pq('.intermediateSection img.product:eq(' . $j . ')')->attr("alt");
|
||||||
|
|
||||||
|
@ -199,6 +210,9 @@ class oebbApi {
|
||||||
$endPlattform =
|
$endPlattform =
|
||||||
pq('.intermediateSection .platform:eq(' . $i . ')')->text();
|
pq('.intermediateSection .platform:eq(' . $i . ')')->text();
|
||||||
|
|
||||||
|
$endPrognose =
|
||||||
|
pq('.intermediateSection .realTime:eq(' . $i . ')')->text();
|
||||||
|
|
||||||
|
|
||||||
$startStation = $this->trim($startStation);
|
$startStation = $this->trim($startStation);
|
||||||
$endStation = $this->trim($endStation);
|
$endStation = $this->trim($endStation);
|
||||||
|
@ -209,8 +223,11 @@ class oebbApi {
|
||||||
$startTime = $this->trim($startTime);
|
$startTime = $this->trim($startTime);
|
||||||
$endTime = $this->trim($endTime);
|
$endTime = $this->trim($endTime);
|
||||||
|
|
||||||
$startPlattform = $this->trim($startPlattform, "\xC2\xA0\n");
|
$startPrognose = $this->trim($startPrognose);
|
||||||
$endPlattform = $this->trim($endPlattform, "\xC2\xA0\n");
|
$endPrognose = $this->trim($endPrognose);
|
||||||
|
|
||||||
|
$startPlattform = $this->trim($startPlattform);
|
||||||
|
$endPlattform = $this->trim($endPlattform);
|
||||||
|
|
||||||
$startPlattform = $this->trim($startPlattform);
|
$startPlattform = $this->trim($startPlattform);
|
||||||
$endPlattform = $this->trim($endPlattform);
|
$endPlattform = $this->trim($endPlattform);
|
||||||
|
@ -230,12 +247,14 @@ class oebbApi {
|
||||||
"time" => $startTime,
|
"time" => $startTime,
|
||||||
"plattform" => $startPlattform,
|
"plattform" => $startPlattform,
|
||||||
"date" => $startDate,
|
"date" => $startDate,
|
||||||
|
"prognose" => $startPrognose,
|
||||||
),
|
),
|
||||||
"end" => array(
|
"end" => array(
|
||||||
"station" => $endStation,
|
"station" => $endStation,
|
||||||
"time" => $endTime,
|
"time" => $endTime,
|
||||||
"plattform" => $endPlattform,
|
"plattform" => $endPlattform,
|
||||||
"date" => $endDate,
|
"date" => $endDate,
|
||||||
|
"prognose" => $endPrognose,
|
||||||
),
|
),
|
||||||
"data" => array(
|
"data" => array(
|
||||||
"productName" => $productName,
|
"productName" => $productName,
|
||||||
|
@ -252,6 +271,7 @@ class oebbApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_SESSION["oebbApi"]["detail"] = $changes;
|
$_SESSION["oebbApi"]["detail"] = $changes;
|
||||||
|
$_SESSION["oebbApi"]["getDetails"] = true;
|
||||||
return $changes;
|
return $changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,6 +375,7 @@ class oebbApi {
|
||||||
"prognose" => $this->getPrognose($pos),
|
"prognose" => $this->getPrognose($pos),
|
||||||
"id" => $this->i,
|
"id" => $this->i,
|
||||||
"earlier" => $this->getEarlierLink(),
|
"earlier" => $this->getEarlierLink(),
|
||||||
|
|
||||||
);
|
);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -421,4 +442,4 @@ class oebbApi {
|
||||||
protected function trim($string) {
|
protected function trim($string) {
|
||||||
return trim($string, "\xC2\xA0\n\t\r\0\x0B");
|
return trim($string, "\xC2\xA0\n\t\r\0\x0B");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue