Compare commits

..

No commits in common. "fc5e632801063f56972d61f4564891ebc2510b7f" and "dd6df158b1a9997acea96c3c88b8727213f1250e^" have entirely different histories.

3 changed files with 6 additions and 70 deletions

View file

@ -1,4 +1,4 @@
Dokumentation für die oebbApi - PHP
Dokumentation für die oebbApi
==========
@ -49,17 +49,11 @@ Station validieren - validate()
**Rückgabewerte**
| Name | Typ | Beschreibung | Wird benötigt |
<<<<<<< HEAD
| ----- | ------ | --------------------------- | ------------- |
| value | string | Gültiger Name der Station | X |
| id | int | Irgend eine ÖBB Stations ID | |
=======
| ----- | ------ | --------------------------- | ------------: |
| value | string | Gültiger Name der Station | Ja |
| id | int | Irgend eine ÖBB Stations ID | Nein |
>>>>>>> cada5275f155639e1f29bab8507bc144f6722a62
***Beispiel***
```php
@ -186,7 +180,7 @@ array(1) {
```
Details einer Verbindung - getDetails()
Details einer Verbindung - getDetails
-----------
@ -205,43 +199,7 @@ Details einer Verbindung - getDetails()
| ---- | --- | -------------------------------------------- | ----------------: |
| id | int | Index der spezifischen Verbindung. Siehe get | Ja |
**Rückgabewerte**
<<<<<<< HEAD
| 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
=======
**Rückgabewerte**
@ -326,7 +284,6 @@ array(1) {
Koordinaten einer ganzen Verbindung - getCoords()
-----------
>>>>>>> cada5275f155639e1f29bab8507bc144f6722a62

View file

@ -3,13 +3,12 @@
require_once 'phpquery/phpQuery/phpQuery.php';
class oebbApi {
protected $i = 0;
protected $data = array();
public function __construct() {
session_start();
$_SESSION["oebbApi"]["get"] = false;
$_SESSION["oebbApi"]["getDetails"] = false;
}
public function get($departure, $arrival, $amount, $date = null, $time = null, $timeMode = false) {
@ -53,14 +52,10 @@ class oebbApi {
}
}
$_SESSION["oebbApi"] = $this->data;
$_SESSION["oebbApi"]["get"] = true;
return $this->data;
}
public function getCoords() {
if($_SESSION["oebbApi"]["getDetails"] == false) {
return false;
}
$details = $_SESSION["oebbApi"]["detail"];
$returnArray = array();
foreach ($details AS $detail) {
@ -136,9 +131,6 @@ class oebbApi {
if ($index > count($_SESSION["oebbApi"])) {
return false;
}
if($_SESSION["oebbApi"]["get"] == false) {
return false;
}
$this->loadUrl($_SESSION["oebbApi"][$index]["changesLink"]);
@ -173,9 +165,6 @@ class oebbApi {
$startPlattform =
pq('.intermediateSection .platform:eq(' . $i . ')')->text();
$startPrognose =
pq('.intermediateSection .realTime:eq(' . $i . ')')->text();
$productName =
pq('.intermediateSection img.product:eq(' . $j . ')')->attr("alt");
@ -210,9 +199,6 @@ class oebbApi {
$endPlattform =
pq('.intermediateSection .platform:eq(' . $i . ')')->text();
$endPrognose =
pq('.intermediateSection .realTime:eq(' . $i . ')')->text();
$startStation = $this->trim($startStation);
$endStation = $this->trim($endStation);
@ -223,11 +209,8 @@ class oebbApi {
$startTime = $this->trim($startTime);
$endTime = $this->trim($endTime);
$startPrognose = $this->trim($startPrognose);
$endPrognose = $this->trim($endPrognose);
$startPlattform = $this->trim($startPlattform);
$endPlattform = $this->trim($endPlattform);
$startPlattform = $this->trim($startPlattform, "\xC2\xA0\n");
$endPlattform = $this->trim($endPlattform, "\xC2\xA0\n");
$startPlattform = $this->trim($startPlattform);
$endPlattform = $this->trim($endPlattform);
@ -247,14 +230,12 @@ class oebbApi {
"time" => $startTime,
"plattform" => $startPlattform,
"date" => $startDate,
"prognose" => $startPrognose,
),
"end" => array(
"station" => $endStation,
"time" => $endTime,
"plattform" => $endPlattform,
"date" => $endDate,
"prognose" => $endPrognose,
),
"data" => array(
"productName" => $productName,
@ -271,7 +252,6 @@ class oebbApi {
}
}
$_SESSION["oebbApi"]["detail"] = $changes;
$_SESSION["oebbApi"]["getDetails"] = true;
return $changes;
}
@ -375,7 +355,6 @@ class oebbApi {
"prognose" => $this->getPrognose($pos),
"id" => $this->i,
"earlier" => $this->getEarlierLink(),
);
return $data;
}
@ -442,4 +421,4 @@ class oebbApi {
protected function trim($string) {
return trim($string, "\xC2\xA0\n\t\r\0\x0B");
}
}
}

BIN
oebbApi_v0.3-Doku.pdf Normal file

Binary file not shown.