RATP Wsiv - Web Service Informations Voyageur (part 1)

Les données temps réel de la RATP sont disponibles sous forme d'un Web Service basé sur SOAP et WSDL. Cette API propose deux services :

  • Structure : lignes et stations du réseau RATP
  • Horaires : Prochains passages, 1er/dernier départs et fréquences de passage

L'utilisation de cette API nécessite une inscription (à réaliser depuis la page de l'API). L'offre gratuite est limitée à 30.000.000 requêtes maximum par mois et 200 requêtes par seconde. Ceci nous laisse une souplesse énorme par rapport à l'API temps réel Transilien (qui elle est limitée à 20 appels par minutes). La documentation est précise et permet de s'approprier facilement son utilisation.

 

Découverte du service

Initialisation du service

<?php

$options = array(
    'soap_version' => SOAP_1_2,
    'compression'  => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
    'encoding'     => 'UTF-8',
    'cache_wsdl'   => WSDL_CACHE_NONE
    );
$soapclient = new SoapClient("Wsiv.wsdl", $options );

 

Liste de fonctions SOAP publiées

$response = $soapclient->__getFunctions();
$result = array_unique ( $response, SORT_STRING );
sort( $result );
Array
(
    [0] => getDirectionsResponse getDirections(getDirections $parameters)
    [1] => getGeoPointsResponse getGeoPoints(getGeoPoints $parameters)
    [2] => getLinesResponse getLines(getLines $parameters)
    [3] => getMissionResponse getMission(getMission $parameters)
    [4] => getMissionsFirstLastResponse getMissionsFirstLast(getMissionsFirstLast $parameters)
    [5] => getMissionsFrequencyResponse getMissionsFrequency(getMissionsFrequency $parameters)
    [6] => getMissionsNextResponse getMissionsNext(getMissionsNext $parameters)
    [7] => getPerturbationsResponse getPerturbations(getPerturbations $parameters)
    [8] => getStationsResponse getStations(getStations $parameters)
    [9] => getVersionResponse getVersion()
)

 

Liste des types SOAP

$response = $soapclient->__getTypes();
Array
(
    [0] => struct GeoPoint {
 string id;
 string name;
 string nameSuffix;
 string type;
 double x;
 double y;
}
    [1] => struct Line {
 string code;
 string codeStif;
 string id;
 string image;
 string name;
 string realm;
 Reseau reseau;
}
    [2] => struct Reseau {
 string code;
 string id;
 string image;
 string name;
}

    ...
)

 

Version de l'API

$response = $soapclient->getVersion();
object(stdClass)#2 (1) {
  ["return"]=>
  string(16) "2.6.1 / 20180424"
}

 

getLines

Cette méthode permet d'obtenir des informations sur une ligne RATP (bus, RER et métro).

Types :

$response = $soapclient->__getTypes();

----------

Array
(
    ...

    [1] => struct Line {
 string code;
 string codeStif;
 string id;
 string image;
 string name;
 string realm;
 Reseau reseau;
}
    ...

    [24] => struct getLines {
 Line line;
}
    [25] => struct getLinesResponse {
 Line return;
}

    ...
)

 

Cette méthode accepte un argument de type "Line" et retourne un tableau contenant des types "Line". Il est possible de rechercher selon deux modalités :

  • soit à partir de l'identifiant unique de la ligne
  • soit à partir des arguments code, codeStif et realm

A partir de l'identifiant unique de la ligne : id

  • pour utiliser le domaine théorique, l'identifiant doit être de type numérique. Par ex. 66 pour la ligne 13 du métro
  • pour utiliser le domaine temps réel, l'identifiant doit être construit de la manière suivante : 1ère lettre du réseau + code commercial de la ligne
    M : Métro, par ex. M13
    B : Bus, par exemple B81
    R : RER, par ex. RA
    N : Noctilien

Par exemple pour la ligne 13 du métro :

$params = array('line' => array( 'id' => "M13" ));
$response = $soapclient->getLines($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [code] => 13
            [codeStif] => 100110013
            [id] => M13
            [image] => m13.gif
            [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
            [realm] => r
            [reseau] => stdClass Object
                (
                    [code] => metro
                    [id] => 1-metro
                    [image] => p_met.gif
                    [name] => Métro
                )
        )
)

Vous noterez que "realm" est à "r" : domaines temps réél.
Les images (m13.gif et p_met.gif) sont accessible via l'url : http://opendata-tr.ratp.fr/wsiv/static/line/

 

 

$params = array('line' => array( 'id' => "66" ));
$response = $soapclient->getLines($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [code] => 13
            [codeStif] => 100110013
            [id] => 66
            [image] => m13.gif
            [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
            [realm] => t
            [reseau] => stdClass Object
                (
                    [code] => metro
                    [id] => 1-metro
                    [image] => p_met.gif
                    [name] => Métro
                )
        )
)

Vous noterez que "realm" est à "t" : domaines théorique.

 

A partir des autres arguments

Il est possible d'utiliser les arguments suivants :

  • code
  • codeStif
  • realm : Domaine (t/r) ou Critère étendu (rANDt/rTHENt).
    • t : domaine théorique (valeur par défaut)
    • r : domaine temps réel
    • rANDt : temps réel ET théorique (recherche dans les 2 domaines)
    • rTHENt : temps réel PUIS théorique (recherche en 1er lieu dans le domaine temps réel puis, dans le domaine théorique si la 1ère recherche a été infructueuse).

Exemples :

$params = array('line' => array(
    'codeStif' => "100110013",
    'realm' => "rANDt"
    )
);
$response = $soapclient->getLines($params);
stdClass Object
(
    [return] => Array
        (
            [0] => stdClass Object
                (
                    [code] => 13
                    [codeStif] => 100110013
                    [id] => M13
                    [image] => m13.gif
                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [1] => stdClass Object
                (
                    [code] => 13
                    [codeStif] => 100110013
                    [id] => 66
                    [image] => m13.gif
                    [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                    [realm] => t
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )
        )
)

 

$params = array('line' => array(
    'codeStif' => "1001100*",
    'realm' => "rANDt"
    )
);
$response = $soapclient->getLines($params);
stdClass Object
(
    [return] => Array
        (
            [0] => stdClass Object
                (
                    [code] => 1
                    [codeStif] => 100110001
                    [id] => M1
                    [image] => m1.gif
                    [name] => La Défense / Château de Vincennes
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [1] => stdClass Object
                (
                    [code] => 1
                    [codeStif] => 100110001
                    [id] => 62
                    [image] => m1.gif
                    [name] => La Defense / Chateau de Vincennes
                    [realm] => t
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [2] => stdClass Object
                (
                    [code] => 2
                    [codeStif] => 100110002
                    [id] => M2
                    [image] => m2.gif
                    [name] => Porte Dauphine / Nation
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [3] => stdClass Object
                (
                    [code] => 2
                    [codeStif] => 100110002
                    [id] => 67
                    [image] => m2.gif
                    [name] => Porte Dauphine / Nation
                    [realm] => t
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )
            ...
)

 

Il est également possible d'inclure le type "Reseau" dans la recherche :

$params = array('line' => array(
    'realm' => "r",
    'reseau' => array('code' => "metro")
    )
);
$response = $soapclient->getLines($params);
stdClass Object
(
    [return] => Array
        (
            [0] => stdClass Object
                (
                    [code] => 1
                    [codeStif] => 100110001
                    [id] => M1
                    [image] => m1.gif
                    [name] => La Défense / Château de Vincennes
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [1] => stdClass Object
                (
                    [code] => 2
                    [codeStif] => 100110002
                    [id] => M2
                    [image] => m2.gif
                    [name] => Porte Dauphine / Nation
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [2] => stdClass Object
                (
                    [code] => 3
                    [codeStif] => 100110003
                    [id] => M3
                    [image] => m3.gif
                    [name] => Pont de Levallois Bécon / Gallieni
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [3] => stdClass Object
                (
                    [code] => 3b
                    [codeStif] => 100110103
                    [id] => M3B
                    [image] => m3b.gif
                    [name] => Gambetta / Porte des Lilas
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [4] => stdClass Object
                (
                    [code] => 4
                    [codeStif] => 100110004
                    [id] => M4
                    [image] => m4.gif
                    [name] => Mairie de Montrouge / Porte de Clignancourt
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            ...
)

 

getDirections

Cette méthode permet de récupérer les directions d'une ligne :

  • une ligne classique possède deux directions
  • une ligne circulaire possède une seule direction

Types :

$response = $soapclient->__getTypes();

----------

Array
(
    ...

    [1] => struct Line {
 string code;
 string codeStif;
 string id;
 string image;
 string name;
 string realm;
 Reseau reseau;
}
    ....

    [3] => struct WrDirections {
 string ambiguityMessage;
 Line ambiguousLines;
 Line argumentLine;
 Direction directions;
}
    [4] => struct Direction {
 Line line;
 string name;
 string sens;
 Station stationsEndLine;
}
    [26] => struct getDirections {
 Line line;
}
    [27] => struct getDirectionsResponse {
 WrDirections return;
}

    ...
)

Cette méthode accepte un argument de type "Line" et retourne un tableau contenant des types "WrDirections".

 

Exemples :

$params = array('line' => array( 'id' => "M13" ));
$response = $soapclient->getDirections($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [argumentLine] => stdClass Object
                (
                    [code] => 13
                    [codeStif] => 100110013
                    [id] => M13
                    [image] => m13.gif
                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )
            [directions] => Array
                (
                    [0] => stdClass Object
                        (
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => M13
                                    [image] => m13.gif
                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université
                            [sens] => A
                            [stationsEndLine] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [direction] => 
                                            [geoPointA] => stdClass Object
                                                (
                                                    [id] => 140078
                                                    [name] => Saint-Denis-Universite
                                                )
                                            [geoPointR] => stdClass Object
                                                (
                                                    [id] => 140079
                                                    [name] => Saint-Denis-Universite
                                                )
                                            [id] => 568
                                            [idsNextA] => 
                                            [idsNextR] => 132
                                            [line] => stdClass Object
                                                (
                                                    [code] => 13
                                                    [codeStif] => 100110013
                                                    [id] => M13
                                                    [image] => m13.gif
                                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                                    [realm] => r
                                                    [reseau] => stdClass Object
                                                        (
                                                            [code] => metro
                                                            [id] => 1-metro
                                                            [image] => p_met.gif
                                                            [name] => Métro
                                                        )
                                                )
                                            [name] => Saint-Denis-Université
                                        )

                                    [1] => stdClass Object
                                        (
                                            [direction] => 
                                            [geoPointA] => stdClass Object
                                                (
                                                    [id] => 1662797
                                                    [name] => Asnieres-Gennevilliers Les Courtilles
                                                )
                                            [geoPointR] => stdClass Object
                                                (
                                                    [id] => 1662798
                                                    [name] => Asnieres-Gennevilliers Les Courtilles
                                                )
                                            [id] => 991
                                            [idsNextA] => 
                                            [idsNextR] => 990
                                            [line] => stdClass Object
                                                (
                                                    [code] => 13
                                                    [codeStif] => 100110013
                                                    [id] => M13
                                                    [image] => m13.gif
                                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                                    [realm] => r
                                                    [reseau] => stdClass Object
                                                        (
                                                            [code] => metro
                                                            [id] => 1-metro
                                                            [image] => p_met.gif
                                                            [name] => Métro
                                                        )
                                                )
                                            [name] => Asnières-Gennevilliers - Les Courtilles
                                        )
                                )
                        )

                    [1] => stdClass Object
                        (
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => M13
                                    [image] => m13.gif
                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Châtillon-Montrouge
                            [sens] => R
                            [stationsEndLine] => stdClass Object
                                (
                                    [direction] => 
                                    [geoPointA] => stdClass Object
                                        (
                                            [id] => 1969
                                            [name] => Chatillon Montrouge
                                        )
                                    [geoPointR] => stdClass Object
                                        (
                                            [id] => 2224
                                            [name] => Chatillon Montrouge
                                        )
                                    [id] => 202
                                    [idsNextA] => 407
                                    [idsNextR] => 
                                    [line] => stdClass Object
                                        (
                                            [code] => 13
                                            [codeStif] => 100110013
                                            [id] => M13
                                            [image] => m13.gif
                                            [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                            [realm] => r
                                            [reseau] => stdClass Object
                                                (
                                                    [code] => metro
                                                    [id] => 1-metro
                                                    [image] => p_met.gif
                                                    [name] => Métro
                                                )
                                        )
                                    [name] => Châtillon-Montrouge
                                )
                        )
                )
        )
)

 

 

$params = array('line' => array( 'id' => "66" ));
$response = $soapclient->getDirections($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [argumentLine] => stdClass Object
                (
                    [code] => 13
                    [codeStif] => 100110013
                    [id] => 66
                    [image] => m13.gif
                    [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                    [realm] => t
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )
            [directions] => Array
                (

                    [0] => stdClass Object
                        (
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => 66
                                    [image] => m13.gif
                                    [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                                    [realm] => t
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Denis-Universite / Asnieres-Gennevilliers Les Courtilles
                            [sens] => A
                            [stationsEndLine] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [id] => 140078-140079
                                            [line] => stdClass Object
                                                (
                                                    [code] => 13
                                                    [codeStif] => 100110013
                                                    [id] => 66
                                                    [image] => m13.gif
                                                    [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                                                    [realm] => t
                                                    [reseau] => stdClass Object
                                                        (
                                                            [code] => metro
                                                            [id] => 1-metro
                                                            [image] => p_met.gif
                                                            [name] => Métro
                                                        )
                                                )
                                            [name] => Saint-Denis-Universite
                                            [stationArea] => stdClass Object
                                                (
                                                    [id] => 568
                                                )
                                        )
                                    [1] => stdClass Object
                                        (
                                            [geoPointA] => stdClass Object
                                                (
                                                    [id] => 1662797
                                                    [name] => Asnières-Gennevilliers - Les Courtilles
                                                )
                                            [geoPointR] => stdClass Object
                                                (
                                                    [id] => 1662798
                                                    [name] => Asnières-Gennevilliers - Les Courtilles
                                                )
                                            [id] => 1662797-1662798
                                            [line] => stdClass Object
                                                (
                                                    [code] => 13
                                                    [codeStif] => 100110013
                                                    [id] => 66
                                                    [image] => m13.gif
                                                    [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                                                    [realm] => t
                                                    [reseau] => stdClass Object
                                                        (
                                                            [code] => metro
                                                            [id] => 1-metro
                                                            [image] => p_met.gif
                                                            [name] => Métro
                                                        )
                                                )
                                            [name] => Asnieres-Gennevilliers Les Courtilles
                                            [stationArea] => stdClass Object
                                                (
                                                    [id] => 991
                                                )
                                        )
                                )
                        )

                    [1] => stdClass Object
                        (
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => 66
                                    [image] => m13.gif
                                    [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                                    [realm] => t
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Chatillon Montrouge
                            [sens] => R
                            [stationsEndLine] => stdClass Object
                                (
                                    [geoPointA] => stdClass Object
                                        (
                                            [id] => 1969
                                            [name] => Châtillon-Montrouge
                                        )
                                    [geoPointR] => stdClass Object
                                        (
                                            [id] => 2224
                                            [name] => Châtillon-Montrouge
                                        )
                                    [id] => 1969-2224
                                    [line] => stdClass Object
                                        (
                                            [code] => 13
                                            [codeStif] => 100110013
                                            [id] => 66
                                            [image] => m13.gif
                                            [name] => St-Denis-Universite/Les Courtilles / Chatillon - Montrouge
                                            [realm] => t
                                            [reseau] => stdClass Object
                                                (
                                                    [code] => metro
                                                    [id] => 1-metro
                                                    [image] => p_met.gif
                                                    [name] => Métro
                                                )
                                        )
                                    [name] => Chatillon Montrouge
                                    [stationArea] => stdClass Object
                                        (
                                            [id] => 202
                                        )
                                )
                        )
                )
        )
)

 

getStations

Cette méthode permet de récupérer des stations du réseau RATP.

Types :

$response = $soapclient->__getTypes();

----------

Array
(
    [0] => struct GeoPoint {
 string id;
 string name;
 string nameSuffix;
 string type;
 double x;
 double y;
}
    ...

    [5] => struct Station {
 Direction direction;
 GeoPoint geoPointA;
 GeoPoint geoPointR;
 string id;
 string idsNextA;
 string idsNextR;
 Line line;
 string name;
 StationArea stationArea;
}
    [21] => struct WrStations {
 string ambiguityMessage;
 GeoPoint ambiguousGeoPoints;
 Line ambiguousLines;
 Direction argumentDirection;
 GeoPoint argumentGeoPoint;
 Line argumentLine;
 int distances;
 Station stations;
}

    [38] => struct getStations {
 Station station;
 GeoPoint gp;
 int distances;
 int limit;
 boolean sortAlpha;
}

    [39] => struct getStationsResponse {
 WrStations return;
}

    ...
)

Cette méthode accepte un argument de type "Station" et de type "GeoPoint". Elle retourne un tableau contenant des types "WrStations".

 

Recherche des stations d'une ligne

$params = array( 
    'station' => array(
        'line' => array('id' => "M13"),
        )
);
$response = $soapclient->getStations($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [ambiguityMessage] => 
            [ambiguousLines] => 
            [argumentLine] => stdClass Object
                (
                    [code] => 13
                    [codeStif] => 100110013
                    [id] => M13
                    [image] => m13.gif
                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )

            [distances] => 
            [stations] => Array
                (
                    [0] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1969
                                    [name] => Chatillon Montrouge
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2224
                                    [name] => Chatillon Montrouge
                                )
                            [id] => 202
                            [idsNextA] => 407
                            [idsNextR] => 
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => M13
                                    [image] => m13.gif
                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Châtillon-Montrouge
                        )

                        ...

                        [31] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1662797
                                    [name] => Asnieres-Gennevilliers Les Courtilles
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 1662798
                                    [name] => Asnieres-Gennevilliers Les Courtilles
                                )
                            [id] => 991
                            [idsNextA] => 
                            [idsNextR] => 990
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => M13
                                    [image] => m13.gif
                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )

                                )
                            [name] => Asnières-Gennevilliers - Les Courtilles
                        )
                )
        )
)

 

$params = array( 
    'station' => array(
        'line' => array('id' => "66"),
        )
);
$response = $soapclient->getStations($params);

 

Recherche des stations par nom

$params = array( 
    'station' => array(
        'line' => array('realm' => "r"),
        'name' => "saint-lazare*"
        )
);
$response = $soapclient->getStations($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [ambiguityMessage] => 
            [ambiguousLines] => 
            [distances] => 
            [stations] => Array
                (

                    [0] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1722
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2467
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 262
                            [idsNextR] => 302
                            [line] => stdClass Object
                                (
                                    [code] => 3
                                    [codeStif] => 100110003
                                    [id] => M3
                                    [image] => m3.gif
                                    [name] => Pont de Levallois Bécon / Gallieni
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [1] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1723
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2468
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 625
                            [idsNextR] => 392
                            [line] => stdClass Object
                                (
                                    [code] => 12
                                    [codeStif] => 100110012
                                    [id] => M12
                                    [image] => m12.gif
                                    [name] => Front Populaire / Mairie d Issy
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [2] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1724
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2469
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 380
                            [idsNextR] => 430
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => M13
                                    [image] => m13.gif
                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [3] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1166840
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 1166841
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 
                            [idsNextR] => 392
                            [line] => stdClass Object
                                (
                                    [code] => 14
                                    [codeStif] => 100110014
                                    [id] => M14
                                    [image] => m14.gif
                                    [name] => Saint-Lazare / Olympiades
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [4] => stdClass Object
                        (
                            [direction] => stdClass Object
                                (
                                    [sens] => A
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 3926243
                                    [name] => Gare Saint-Lazare - Budapest
                                )
                            [id] => 95_699
                            [idsNextA] => 95_2164_11230
                            [idsNextR] => 
                            [line] => stdClass Object
                                (
                                    [code] => 95
                                    [codeStif] => 100100095
                                    [id] => B95
                                    [image] => b95.gif
                                    [name] => Porte de Vanves / Porte de Montmartre
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => busratp
                                            [id] => 4-busratp
                                            [image] => p_bus.gif
                                            [name] => Bus RATP
                                        )
                                )
                            [name] => St Lazare-Budapest
                        )


                    [5] => stdClass Object
                        (
                            [direction] => stdClass Object
                                (
                                    [sens] => A
                                )
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 4472689
                                    [name] => Gare Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 4472690
                                    [name] => Gare Saint-Lazare
                                )
                            [id] => N24_798_21673
                            [idsNextA] => Array
                                (
                                    [0] => N24_11671_11755
                                    [1] => N24_872
                                )
                            [idsNextR] => 
                            [line] => stdClass Object
                                (
                                    [code] => N24
                                    [codeStif] => 100987751
                                    [id] => BN24
                                    [image] => bn24.gif
                                    [name] => Gare de Sartrouville-RER / Chatelet
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => noctilienratp
                                            [id] => 4-noctilienratp
                                            [image] => p_noctilien.gif
                                            [name] => Noctilien
                                        )
                                )
                            [name] => Saint-Lazare
                        )
                )
        )
)

 

 

$params = array( 
    'station' => array(
        'line' => array('id' => "M13", 'realm' => "r"),
        'name' => "saint-lazare*"
        )
);
$response = $soapclient->getStations($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [ambiguityMessage] => 
            [ambiguousLines] => 
            [argumentLine] => stdClass Object
                (
                    [code] => 13
                    [codeStif] => 100110013
                    [id] => M13
                    [image] => m13.gif
                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                    [realm] => r
                    [reseau] => stdClass Object
                        (
                            [code] => metro
                            [id] => 1-metro
                            [image] => p_met.gif
                            [name] => Métro
                        )
                )
            [distances] => 
            [stations] => stdClass Object
                (
                    [direction] => 
                    [geoPointA] => stdClass Object
                        (
                            [id] => 1724
                            [name] => Saint-Lazare
                        )
                    [geoPointR] => stdClass Object
                        (
                            [id] => 2469
                            [name] => Saint-Lazare
                        )
                    [id] => 577
                    [idsNextA] => 380
                    [idsNextR] => 430
                    [line] => stdClass Object
                        (
                            [code] => 13
                            [codeStif] => 100110013
                            [id] => M13
                            [image] => m13.gif
                            [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                            [realm] => r
                            [reseau] => stdClass Object
                                (
                                    [code] => metro
                                    [id] => 1-metro
                                    [image] => p_met.gif
                                    [name] => Métro
                                )
                        )
                    [name] => Saint-Lazare
                )
        )
)

 

 

$params = array( 
    'station' => array(
        'line' => array(
            'realm' => "r",
            'reseau' => array('code' => "metro")
        ),
        'name' => "saint-lazare*"
    )
);
$response = $soapclient->getStations($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [ambiguityMessage] => 
            [ambiguousLines] => 
            [distances] => 
            [stations] => Array
                (

                    [0] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1722
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2467
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 262
                            [idsNextR] => 302
                            [line] => stdClass Object
                                (
                                    [code] => 3
                                    [codeStif] => 100110003
                                    [id] => M3
                                    [image] => m3.gif
                                    [name] => Pont de Levallois Bécon / Gallieni
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [1] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1723
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2468
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 625
                            [idsNextR] => 392
                            [line] => stdClass Object
                                (
                                    [code] => 12
                                    [codeStif] => 100110012
                                    [id] => M12
                                    [image] => m12.gif
                                    [name] => Front Populaire / Mairie d Issy
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [2] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1724
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2469
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 380
                            [idsNextR] => 430
                            [line] => stdClass Object
                                (
                                    [code] => 13
                                    [codeStif] => 100110013
                                    [id] => M13
                                    [image] => m13.gif
                                    [name] => Asnières-Gennevilliers Les Courtilles - Saint-Denis-Université / Châtillon-Montrouge
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [3] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1166840
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 1166841
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 
                            [idsNextR] => 392
                            [line] => stdClass Object
                                (
                                    [code] => 14
                                    [codeStif] => 100110014
                                    [id] => M14
                                    [image] => m14.gif
                                    [name] => Saint-Lazare / Olympiades
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )
                )
        )
)

 

Recherche des stations par coordonnées géographiques

Cette recherche permet de récupérer les stations situées sur une surface géographique centrée sur un point exprimé en coordonnées X,Y Lambert2. Le problème sera la conversion des coordonnées en Lambert2. Pour cela vous pouvez vous tourner vers Mimee de Pierre Brial (javascript, GNU GPLv3) ou sur le site geodesie.ign.fr (NT/G 71 Projection cartographique de Lambert) (c'est pas si compliqué que ça, si si, on verra ça dans un prochain épisode)

 

$params = array( 
    'station' => array(
        'line' => array('realm' => "r")
        ),
    'gp' => array('x' => 599155.852029, 'y' => 2430839.27489 ),
    'distances' => 100,
    'limit' => 3
);
$response = $soapclient->getStations($params);
stdClass Object
(
    [return] => stdClass Object
        (
            [ambiguityMessage] => 
            [ambiguousLines] => 
            [argumentGeoPoint] => stdClass Object
                (
                    [x] => 599155.852029
                    [y] => 2430839.27489
                )
            [distances] => Array
                (
                    [0] => 35
                    [1] => 94
                    [2] => 94
                )
            [stations] => Array
                (

                    [0] => stdClass Object
                        (
                            [direction] => stdClass Object
                                (
                                    [sens] => R
                                )
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 5657267
                                    [name] => Gare Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 5657268
                                    [name] => Gare Saint-Lazare
                                )
                            [id] => 26_26001
                            [idsNextA] => 
                            [idsNextR] => 26_26004_26229
                            [line] => stdClass Object
                                (
                                    [code] => 26
                                    [codeStif] => 100100026
                                    [id] => B26
                                    [image] => b26.gif
                                    [name] => Gare Saint-Lazare / Nation
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => busratp
                                            [id] => 4-busratp
                                            [image] => p_bus.gif
                                            [name] => Bus RATP
                                        )
                                )
                            [name] => Gare Saint-Lazare
                        )


                    [1] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1722
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2467
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 262
                            [idsNextR] => 302
                            [line] => stdClass Object
                                (
                                    [code] => 3
                                    [codeStif] => 100110003
                                    [id] => M3
                                    [image] => m3.gif
                                    [name] => Pont de Levallois Bécon / Gallieni
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )


                    [2] => stdClass Object
                        (
                            [direction] => 
                            [geoPointA] => stdClass Object
                                (
                                    [id] => 1723
                                    [name] => Saint-Lazare
                                )
                            [geoPointR] => stdClass Object
                                (
                                    [id] => 2468
                                    [name] => Saint-Lazare
                                )
                            [id] => 577
                            [idsNextA] => 625
                            [idsNextR] => 392
                            [line] => stdClass Object
                                (
                                    [code] => 12
                                    [codeStif] => 100110012
                                    [id] => M12
                                    [image] => m12.gif
                                    [name] => Front Populaire / Mairie d Issy
                                    [realm] => r
                                    [reseau] => stdClass Object
                                        (
                                            [code] => metro
                                            [id] => 1-metro
                                            [image] => p_met.gif
                                            [name] => Métro
                                        )
                                )
                            [name] => Saint-Lazare
                        )
                )
        )
)

 

 

getMissionsNext

Cette méthode permet d'obtenir les informations des prochains passages à une station (pour une ligne et dans un sens donné).

Types :

$response = $soapclient->__getTypes();

----------

Array
(
    ...

    [4] => struct Direction {
 Line line;
 string name;
 string sens;
 Station stationsEndLine;
}

    [5] => struct Station {
 Direction direction;
 GeoPoint geoPointA;
 GeoPoint geoPointR;
 string id;
 string idsNextA;
 string idsNextR;
 Line line;
 string name;
 StationArea stationArea;
}
    [34] => struct getMissionsNext {
 Station station;
 Direction direction;
 string dateStart;
 int limit;
}

    [35] => struct getMissionsNextResponse {
 WrMissions return;
}

    [19] => struct WrMissions {
 string ambiguityMessage;
 Direction ambiguousDirections;
 Line ambiguousLines;
 Station ambiguousStations;
 string argumentDate;
 Direction argumentDirection;
 Line argumentLine;
 Station argumentStation;
 Mission missions;
 Perturbation perturbations;
}

    ...
)

Cette méthode accepte des arguments de type "Station" (voir getStation) et "Direction" et retourne un tableau contenant des types "WrMissions".

 

Exemples :

$params = array( 
    'station' => array(
        'id' => "577",
        'line' => array('id' => "M13"),
        ),
    'direction' => array( 'sens' => "A")

);
$response = $soapclient->getMissionsNext($params);

La réponse est plus que verbeuse. Les principaux éléments contenus sont les suivants :

stdClass Object
(
    [return] => stdClass Object
        (
            [argumentDate]
            [argumentDirection]
            [argumentLine]
            [argumentStation]
            [missions] => Liste des prochains passages (Array)
                (
                    [0..n] => stdClass Object
                        (
                            [code]
                            [direction]
                            [id]
                            [stations]
                            [stationsDates] : Heures de passage (yyyymmddHHii)
                            [stationsMessages] : Messages associés (ex. 3 min, Train a l approche, Train a quai)
                            [stationsPlatforms]
                        )
                )
        )
)

 

Pour réduire la réponse à l'essentiel :

$params = array( 
    'station' => array(
        'id' => "577",
        'line' => array('id' => "M13"),
        ),
    'direction' => array( 'sens' => "A")

);
$response = $soapclient->getMissionsNext($params);


foreach ($response as $key) {
    foreach ($key->missions as $mission) {
        echo $mission->stations[0]->name . " | ";
        echo $mission->stations[1]->name . " | ";
        echo $mission->stationsDates . " | ";
        echo $mission->stationsMessages . "<br>";
    }
}
Saint-Lazare | Saint-Denis-Université | 201805261006 | Train a l approche
Saint-Lazare | Asnières-Gennevilliers - Les Courtilles | 201805261008 | 1 mn
Saint-Lazare | Saint-Denis-Université | 201805261011 | 4 mn
Saint-Lazare | Asnières-Gennevilliers - Les Courtilles | 201805261014 | 7 mn

 

A partir du nom de la station et dans le sens "aller" (A) :

$params = array( 
    'station' => array(
        'line' => array('id' => "M13"),
        'name' => "Liege"
        ),
    'direction' => array( 'sens' => "A")

);
$response = $soapclient->getMissionsNext($params);

foreach ($response as $key) {
    foreach ($key->missions as $mission) {
        echo $mission->stations[0]->name . " | ";
        echo $mission->stations[1]->name . " | ";
        echo $mission->stationsDates . " | ";
        echo $mission->stationsMessages . "<br>";
    }
}
Liège | Saint-Denis-Université | 201805261012 | 0 mn
Liège | Asnières-Gennevilliers - Les Courtilles | 201805261015 | 3 mn
Liège | Saint-Denis-Université | 201805261018 | 6 mn
Liège | Asnières-Gennevilliers - Les Courtilles | 201805261021 | 9 mn

 

A partir du nom de la station et dans le sens "retour" (R) :

$params = array( 
    'station' => array(
        'line' => array('id' => "M13"),
        'name' => "Liege"
        ),
    'direction' => array( 'sens' => "R")

);
$response = $soapclient->getMissionsNext($params);

foreach ($response as $key) {
    foreach ($key->missions as $mission) {
        echo $mission->stations[0]->name . " | ";
        echo $mission->stations[1]->name . " | ";
        echo $mission->stationsDates . " | ";
        echo $mission->stationsMessages . "<br>";
    }
}
Liège | Châtillon-Montrouge | 201805261015 | 1 mn
Liège | Châtillon-Montrouge | 201805261018 | 4 mn
Liège | Châtillon-Montrouge | 201805261021 | 7 mn
Liège | Châtillon-Montrouge | 201805261024 | 10 mn

 

A partir du nom de la station et dans les deux sens (*) :

$params = array( 
    'station' => array(
        'line' => array('id' => "M13"),
        'name' => "Liege"
        ),
    'direction' => array( 'sens' => "*")

);
$response = $soapclient->getMissionsNext($params);

foreach ($response as $key) {
    foreach ($key->missions as $mission) {
        echo $mission->stations[0]->name . " | ";
        echo $mission->stations[1]->name . " | ";
        echo $mission->stationsDates . " | ";
        echo $mission->stationsMessages . "<br>";
    }
}
Liège | Asnières-Gennevilliers - Les Courtilles | 201805261014 | Train a quai
Liège | Saint-Denis-Université | 201805261017 | 2 mn
Liège | Asnières-Gennevilliers - Les Courtilles | 201805261020 | 5 mn
Liège | Saint-Denis-Université | 201805261024 | 9 mn
Liège | Châtillon-Montrouge | 201805261014 | Train a l'approche
Liège | Châtillon-Montrouge | 201805261018 | 3 mn
Liège | Châtillon-Montrouge | 201805261021 | 6 mn
Liège | Châtillon-Montrouge | 201805261024 | 9 mn

 

Autres méthodes

La méthode "getMissionsFirstLast" permet de récupérer les horaires des 1er/dernier passages depuis une station dans le domaine théorique uniquement.

La méthode "getMissionsFrequency" permet de récupérer les fréquences de passage des missions à une station pour une direction donnée dans le domaine théorique uniquement.

 

 

 

Étiquettes