Skip to content

Instantly share code, notes, and snippets.

@creaktive
Last active August 13, 2025 10:51
Show Gist options
  • Save creaktive/e708c3b902c6b0ad4acb8fe22276aab0 to your computer and use it in GitHub Desktop.
Save creaktive/e708c3b902c6b0ad4acb8fe22276aab0 to your computer and use it in GitHub Desktop.
TrainMore QR code
<?php
$PUBLIC_FACILITY_GROUP = ...;
$AUTH_TOKEN = ...;
// get QR code data
$ch = curl_init('https://my.trainmore.nl/nox/v1/customerqrcode/');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_HTTPHEADER => [
'user-agent: Dart/3.8 (dart:io) ios/Version 26.0 (Build 23A5308g)',
'x-nox-client-version: 3.72.1',
'x-nox-client-type: APP_V5',
'accept-language: en',
"x-public-facility-group: $PUBLIC_FACILITY_GROUP",
"x-auth-token: $AUTH_TOKEN"
]
]);
$json = curl_exec($ch);
curl_close($ch);
$data = json_decode($json, true)['content'] ?? '';
// fetch QR code image
$ch = curl_init('https://api.qrserver.com/v1/create-qr-code/?format=png&size=960x960&margin=50&data=' . rawurlencode($data));
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => ''
]);
$svg = curl_exec($ch);
curl_close($ch);
header('Content-Type: image/png');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Expires: 0');
echo $svg;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment