Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // ajax.php for pulling servers from truckersmp.
- //© 2016 Robert Foster
- $data = json_decode( file_get_contents( 'https://api.truckersmp.com/v2/servers' ) );
- //loop through all servers listed on TruckersMP Api
- foreach ( $data->response as $cat ) { ?>
- <!-- Loop the information we want-->
- Server ID: <?php echo $cat->id; ?>
- <?php echo "<br>"?>
- Game Name: <?php echo $cat->name; ?>
- <?php echo "<br>"?>
- Player Count: <?php echo $cat->players; ?>
- <?php echo "<br>"?>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement