Skip to content
This repository was archived by the owner on May 6, 2019. It is now read-only.

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

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

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages