diff --git a/ldbws.php b/ldbws.php
new file mode 100644
index 0000000..6eb066a
--- /dev/null
+++ b/ldbws.php
@@ -0,0 +1,7 @@
+GetDepartureBoard(10,"PAD");
+ header("Content-Type: text/plain");
+ print_r($response);
\ No newline at end of file
diff --git a/php/OpenLDBWS.php b/php/OpenLDBWS.php
new file mode 100644
index 0000000..4eff3f5
--- /dev/null
+++ b/php/OpenLDBWS.php
@@ -0,0 +1,139 @@
+accessToken = $accessToken;
+
+ $this->trace = $trace;
+
+ $soapOptions = array("trace"=>$this->trace,"soap_version"=>SOAP_1_2,"features"=>SOAP_SINGLE_ELEMENT_ARRAYS);
+
+ if (extension_loaded("zlib")) $soapOptions["compression"] = SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP;
+
+ $this->soapClient = new SoapClient("http://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx",$soapOptions);
+
+ $soapVar = new SoapVar(array("ns2:TokenValue"=>$this->accessToken),SOAP_ENC_OBJECT);
+
+ $soapHeader = new SoapHeader("http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes","AccessToken",$soapVar,FALSE);
+
+ $this->soapClient->__setSoapHeaders($soapHeader);
+ }
+
+ private function call($method,$params)
+ {
+ try
+ {
+ $response = $this->soapClient->$method($params);
+ }
+ catch(SoapFault $soapFault)
+ {
+ if ($this->trace)
+ {
+ $traceOutput["soapFaultMessage"] = $soapFault->getMessage();
+
+ $traceOutput["soapClientRequest"] = str_replace($this->accessToken,"",$this->soapClient->__getLastRequest());
+
+ $traceOutput["soapClientResponse"] = $this->soapClient->__getLastResponse();
+
+ print_r($traceOutput);
+ }
+ }
+
+ return (isset($response)?$response:FALSE);
+ }
+
+ function StationBoard($method,$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow)
+ {
+ $params["numRows"] = $numRows;
+
+ $params["crs"] = $crs;
+
+ if ($filterCrs) $params["filterCrs"] = $filterCrs;
+
+ if ($filterType) $params["filterType"] = $filterType;
+
+ if ($timeOffset) $params["timeOffset"] = $timeOffset;
+
+ if ($timeWindow) $params["timeWindow"] = $timeWindow;
+
+ return $this->call($method,$params);
+ }
+
+ function DeparturesBoard($method,$crs,$filterList,$timeOffset,$timeWindow)
+ {
+ $params["crs"] = $crs;
+
+ $params["filterList"] = $filterList;
+
+ if ($timeOffset) $params["timeOffset"] = $timeOffset;
+
+ if ($timeWindow) $params["timeWindow"] = $timeWindow;
+
+ return $this->call($method,$params);
+ }
+
+ function GetDepartureBoard($numRows,$crs,$filterCrs="",$filterType="",$timeOffset="",$timeWindow="")
+ {
+ return $this->StationBoard("GetDepartureBoard",$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow);
+ }
+
+ function GetDepBoardWithDetails($numRows,$crs,$filterCrs="",$filterType="",$timeOffset="",$timeWindow="")
+ {
+ return $this->StationBoard("GetDepBoardWithDetails",$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow);
+ }
+
+ function GetArrivalBoard($numRows,$crs,$filterCrs="",$filterType="",$timeOffset="",$timeWindow="")
+ {
+ return $this->StationBoard("GetArrivalBoard",$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow);
+ }
+
+ function GetArrBoardWithDetails($numRows,$crs,$filterCrs="",$filterType="",$timeOffset="",$timeWindow="")
+ {
+ return $this->StationBoard("GetArrBoardWithDetails",$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow);
+ }
+
+ function GetArrivalDepartureBoard($numRows,$crs,$filterCrs="",$filterType="",$timeOffset="",$timeWindow="")
+ {
+ return $this->StationBoard("GetArrivalDepartureBoard",$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow);
+ }
+
+ function GetArrDepBoardWithDetails($numRows,$crs,$filterCrs="",$filterType="",$timeOffset="",$timeWindow="")
+ {
+ return $this->StationBoard("GetArrDepBoardWithDetails",$numRows,$crs,$filterCrs,$filterType,$timeOffset,$timeWindow);
+ }
+
+ function GetNextDepartures($crs,$filterList,$timeOffset="",$timeWindow="")
+ {
+ return $this->DeparturesBoard("GetNextDepartures",$crs,$filterList,$timeOffset,$timeWindow);
+ }
+
+ function GetNextDeparturesWithDetails($crs,$filterList,$timeOffset="",$timeWindow="")
+ {
+ return $this->DeparturesBoard("GetNextDeparturesWithDetails",$crs,$filterList,$timeOffset,$timeWindow);
+ }
+
+ function GetFastestDepartures($crs,$filterList,$timeOffset="",$timeWindow="")
+ {
+ return $this->DeparturesBoard("GetFastestDepartures",$crs,$filterList,$timeOffset,$timeWindow);
+ }
+
+ function GetFastestDeparturesWithDetails($crs,$filterList,$timeOffset="",$timeWindow="")
+ {
+ return $this->DeparturesBoard("GetFastestDeparturesWithDetails",$crs,$filterList,$timeOffset,$timeWindow);
+ }
+
+ function GetServiceDetails($serviceID)
+ {
+ $params["serviceID"] = $serviceID;
+
+ return $this->call("GetServiceDetails",$params);
+ }
+ }
+?>
diff --git a/php/openLDBSVWS_copy.php b/php/openLDBSVWS_copy.php
new file mode 100644
index 0000000..98167d7
--- /dev/null
+++ b/php/openLDBSVWS_copy.php
@@ -0,0 +1,341 @@
+
+
+
+
+
+
+
+
+ ';
+
+ function __construct($accessToken,$trace=FALSE)
+ {
+ $this->accessToken = $accessToken;
+
+ $this->trace = $trace;
+
+ $soapOptions = array("trace"=>$this->trace,"soap_version"=>SOAP_1_2,"features"=>SOAP_SINGLE_ELEMENT_ARRAYS);
+
+ if (extension_loaded("zlib")) $soapOptions["compression"] = SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP;
+
+ $this->soapClient = new SoapClient("data:text/plain;base64,".base64_encode($this->wsdl),$soapOptions);
+
+ $soapVar = new SoapVar(array("ns2:TokenValue"=>$this->accessToken),SOAP_ENC_OBJECT);
+
+ $soapHeader = new SoapHeader("http://thalesgroup.com/RTTI/2021-11-01/ldb/commontypes","AccessToken",$soapVar,FALSE);
+
+ $this->soapClient->__setSoapHeaders($soapHeader);
+ }
+
+ private function call($method,$params)
+ {
+ try
+ {
+ $response = $this->soapClient->$method($params);
+ }
+ catch(SoapFault $soapFault)
+ {
+ if ($this->trace)
+ {
+ $traceOutput["soapFaultMessage"] = $soapFault->getMessage();
+
+ $traceOutput["soapClientRequest"] = str_replace($this->accessToken,"",$this->soapClient->__getLastRequest());
+
+ $traceOutput["soapClientResponse"] = $this->soapClient->__getLastResponse();
+
+ print_r($traceOutput);
+ }
+ }
+
+ return (isset($response)?$response:FALSE);
+ }
+
+ function GetBoardByCRS($method,$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices)
+ {
+ $params = array();
+
+ if ($numRows) $params["numRows"] = $numRows;
+
+ if ($crs) $params["crs"] = $crs;
+
+ if ($time) $params["time"] = $time;
+
+ if ($timeWindow) $params["timeWindow"] = $timeWindow;
+
+ if ($filtercrs) $params["filtercrs"] = $filtercrs;
+
+ if ($filterType) $params["filterType"] = $filterType;
+
+ if ($filterTOC) $params["filterTOC"] = $filterTOC;
+
+ if ($services) $params["services"] = $services;
+
+ if ($getNonPassengerServices) $params["getNonPassengerServices"] = $getNonPassengerServices;
+
+ return $this->call($method,$params);
+ }
+
+ function GetArrivalDepartureBoardByCRS($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByCRS("GetArrivalDepartureBoardByCRS",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetArrivalBoardByCRS($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByCRS("GetArrivalBoardByCRS",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetDepartureBoardByCRS($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByCRS("GetDepartureBoardByCRS",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetArrDepBoardWithDetails($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByCRS("GetArrDepBoardWithDetails",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetArrBoardWithDetails($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByCRS("GetArrBoardWithDetails",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetDepBoardWithDetails($numRows="",$crs="",$time="",$timeWindow="",$filtercrs="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByCRS("GetDepBoardWithDetails",$numRows,$crs,$time,$timeWindow,$filtercrs,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetBoardByTIPLOC($method,$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices)
+ {
+ $params = array();
+
+ if ($numRows) $params["numRows"] = $numRows;
+
+ if ($tiploc) $params["tiploc"] = $tiploc;
+
+ if ($time) $params["time"] = $time;
+
+ if ($timeWindow) $params["timeWindow"] = $timeWindow;
+
+ if ($filterTiploc) $params["filterTiploc"] = $filterTiploc;
+
+ if ($filterType) $params["filterType"] = $filterType;
+
+ if ($filterTOC) $params["filterTOC"] = $filterTOC;
+
+ if ($services) $params["services"] = $services;
+
+ if ($getNonPassengerServices) $params["getNonPassengerServices"] = $getNonPassengerServices;
+
+ return $this->call($method,$params);
+ }
+
+ function GetArrivalDepartureBoardByTIPLOC($numRows="",$tiploc="",$time="",$timeWindow="",$filterTiploc="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByTIPLOC("GetArrivalDepartureBoardByTIPLOC",$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetArrivalBoardByTIPLOC($numRows="",$tiploc="",$time="",$timeWindow="",$filterTiploc="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByTIPLOC("GetArrivalBoardByTIPLOC",$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetDepartureBoardByTIPLOC($numRows="",$tiploc="",$time="",$timeWindow="",$filterTiploc="",$filterType="",$filterTOC="",$services="",$getNonPassengerServices="")
+ {
+ return $this->GetBoardByTIPLOC("GetDepartureBoardByTIPLOC",$numRows,$tiploc,$time,$timeWindow,$filterTiploc,$filterType,$filterTOC,$services,$getNonPassengerServices);
+ }
+
+ function GetDepartures($method,$crs,$filterList,$time,$timeWindow,$filterTOC,$services)
+ {
+ $params = array();
+
+ if ($crs) $params["crs"] = $crs;
+
+ if ($filterList) $params["filterList"] = $filterList;
+
+ if ($time) $params["time"] = $time;
+
+ if ($timeWindow) $params["timeWindow"] = $timeWindow;
+
+ if ($filterTOC) $params["filterTOC"] = $filterTOC;
+
+ if ($services) $params["services"] = $services;
+
+ return $this->call($method,$params);
+ }
+
+ function GetNextDepartures($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="")
+ {
+ return $this->GetDepartures("GetNextDepartures",$crs,$filterList,$time,$timeWindow,$filterTOC,$services);
+ }
+
+ function GetFastestDepartures($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="")
+ {
+ return $this->GetDepartures("GetFastestDepartures",$crs,$filterList,$time,$timeWindow,$filterTOC,$services);
+ }
+
+ function GetNextDeparturesWithDetails($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="")
+ {
+ return $this->GetDepartures("GetNextDeparturesWithDetails",$crs,$filterList,$time,$timeWindow,$filterTOC,$services);
+ }
+
+ function GetFastestDeparturesWithDetails($crs="",$filterList="",$time="",$timeWindow="",$filterTOC="",$services="")
+ {
+ return $this->GetDepartures("GetFastestDeparturesWithDetails",$crs,$filterList,$time,$timeWindow,$filterTOC,$services);
+ }
+
+ function GetServiceDetailsByRID($rid="")
+ {
+ $params = array();
+
+ if ($rid) $params["rid"] = $rid;
+
+ return $this->call("GetServiceDetailsByRID",$params);
+ }
+
+ function QueryServices($serviceID="",$sdd="",$filterTime="",$filtercrs="",$tocFilter="")
+ {
+ $params = array();
+
+ if ($serviceID) $params["serviceID"] = $serviceID;
+
+ if ($sdd) $params["sdd"] = $sdd;
+
+ if ($filterTime) $params["filterTime"] = $filterTime;
+
+ if ($filtercrs) $params["filtercrs"] = $filtercrs;
+
+ if ($tocFilter) $params["tocFilter"] = $tocFilter;
+
+ return $this->call("QueryServices",$params);
+ }
+
+ function GetDisruptionList($CRSList="")
+ {
+ $params = array();
+
+ if ($CRSList) $params["CRSList"] = $CRSList;
+
+ return $this->call("GetDisruptionList",$params);
+ }
+ }
+
+ class OpenLDBSVREFWS
+ {
+ private $accessToken;
+
+ private $trace;
+
+ private $wsdl = '
+
+
+
+
+
+
+
+ ';
+
+ function __construct($accessToken,$trace=FALSE)
+ {
+ $this->accessToken = $accessToken;
+
+ $this->trace = $trace;
+
+ $soapOptions = array("trace"=>$this->trace,"soap_version"=>SOAP_1_2,"features"=>SOAP_SINGLE_ELEMENT_ARRAYS);
+
+ if (extension_loaded("zlib")) $soapOptions["compression"] = SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP;
+
+ $this->soapClient = new SoapClient("data:text/plain;base64,".base64_encode($this->wsdl),$soapOptions);
+
+ $soapVar = new SoapVar(array("ns2:TokenValue"=>$this->accessToken),SOAP_ENC_OBJECT);
+
+ $soapHeader = new SoapHeader("http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes","AccessToken",$soapVar,FALSE);
+
+ $this->soapClient->__setSoapHeaders($soapHeader);
+ }
+
+ private function call($method,$params)
+ {
+ try
+ {
+ $response = $this->soapClient->$method($params);
+ }
+ catch(SoapFault $soapFault)
+ {
+ if ($this->trace)
+ {
+ $traceOutput["soapFaultMessage"] = $soapFault->getMessage();
+
+ $traceOutput["soapClientRequest"] = str_replace($this->accessToken,"",$this->soapClient->__getLastRequest());
+
+ $traceOutput["soapClientResponse"] = $this->soapClient->__getLastResponse();
+
+ print_r($traceOutput);
+ }
+ }
+
+ return (isset($response)?$response:FALSE);
+ }
+
+ function GetReasonCode($reasonCode="")
+ {
+ $params = array();
+
+ if ($reasonCode) $params["reasonCode"] = $reasonCode;
+
+ return $this->call("GetReasonCode",$params);
+ }
+
+ function GetReasonCodeList()
+ {
+ $params = array();
+
+ return $this->call("GetReasonCodeList",$params);
+ }
+
+ function GetSourceInstanceNames()
+ {
+ $params = array();
+
+ return $this->call("GetSourceInstanceNames",$params);
+ }
+
+ function GetTOCList($currentVersion="")
+ {
+ $params = array();
+
+ if ($currentVersion) $params["currentVersion"] = $currentVersion;
+
+ return $this->call("GetTOCList",$params);
+ }
+
+ function GetStationList($currentVersion="")
+ {
+ $params = array();
+
+ if ($currentVersion) $params["currentVersion"] = $currentVersion;
+
+ return $this->call("GetStationList",$params);
+ }
+ }
+?>