Skip to content

@ptz0n /example.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tågtider API - Example Request
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<h1>Tågtider API - Exempel</h1>
<pre><?php
// Setup
$url = 'http://api.tagtider.net/v1/stations.json';
$key = 'tagtider';
$secret = 'codemocracy';
$options = array(
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Tågtider Exempel',
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
CURLOPT_USERPWD => $key . ":" . $secret,
CURLOPT_RETURNTRANSFER => 3,
);
// Handle and return
$session = curl_init();
curl_setopt_array($session, $options);
$response = curl_exec($session);
curl_close($session);
// Print
if($response)
print_r(json_decode($response));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.