Skip to content
This repository has been archived by the owner on May 6, 2019. It is now read-only.
/ dsbmobile-php-api Public archive

This library lets you access content from DSBmobile in php.

License

Notifications You must be signed in to change notification settings

irgendwr/dsbmobile-php-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsbmobile-php-api

Documentation Travis

This library lets you access content from DSBmobile in php.

Requirements

  • PHP 5.4.x or newer
  • curl module for php (on debian/ubuntu: apt install php7.0-curl)

Example

Basic example

<?php
include('path/to/dsb_api.php');

// log in
$dsb = new DsbAccount('username', 'password');

// get the url of the first timetable
$timetableUrl = $dsb->getTimetables()->getItem(0)->getUrl();

if ($timetableUrl) {
    echo '<a href="' . $timetableUrl . '">Timetable</a>';
} else {
    // an error occurred
    echo '<h2>Something went wrong 🙁</h2>';
}

Display every timetable

// get all timetables
$timetables = $dsb->getTimetables()->getItems();

// loop through every one of them
foreach ($timetables as $timetable) {
    // output their html code
    echo $timetable->getHTML();
}

// check if an error occurred
if (count($timetables) == 0) {
    echo '<h2>Something went wrong 🙁</h2>';
}

A complete list of methods can be found in the documentation.

About

This library lets you access content from DSBmobile in php.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages