API: https://www.mvg.de/api/fahrinfo/location/queryWeb?q=maillinger
“q” is the search-parameter you can use. If a station is found there is a link to another page which shows the next departing trains. more
In Action:
curlGET failed, http-code: 404To realize such form do this create a JCI-PRO-Template:
- urlparam4twig: su
- URL (default search “blutenburg”):
{% set su = "blutenburg" %} {% if urlparam.su %}{% set su = urlparam.su | trim | url_encode %} {% endif %} https://www.mvg.de/api/fahrinfo/location/queryWeb?q={{su}}
twig-template:
{% set su = "blutenburg" %} {% if urlparam.su %} {% set su = urlparam.su | trim %} {% endif %} <form action =""> <input type=text name=su value="{{su | e | stripslashes }}"> <input type=submit value="Search"> </form> <hr> {% set hits = (locations | length ) %} {% if hits>0 %} {{hits}} Treffer:<br> <ul> {% for item in locations %} <li> {% for prok, prov in item.products %} {{prov}} {% endfor %} {% if item.type=="station" %} tariffZones: {{item.tariffZones}}, <a href="/pro-mvg-api-stationdetails/?stationid={{item.id}}&su={{su | url_encode}}">next trains</a> - {% endif %} {{item.place}} {% if item.street %} , {{item.street}} {% endif %} {% if item.name %} , {{item.name}} {% endif %} , <a href="https://www.google.com/maps/dir//{{item.latitude}},{{item.longitude}}/@{{item.latitude}},{{item.longitude}},15z?hl=en" target="_blank">GoogleMaps</a> </li> {% endfor %} </ul> {% else %} nothing found {% endif %} Examples: <a href="./?su=volksbad">"Volksbad" also finds "Volksbank"</a> | <a href="./?su=sushi">Sushi in Munich</a> | <a href="./?su=fc+bayern">FC Bayern</a>