PHP文件存在&Wordpress Shortcode

I'm trying to retrieve the number of parking lots from a .txt file, its working on the static site iframe but I want to make a shortcode and place it on wordpress theme function file.

For some reason it's not reading the data...

function GenerateLOT($atts = array()) {

// Default Parameters
extract(shortcode_atts(array(
    'id' => 'id'
), $atts));

// Create Default Park / Help
if ($id == '') {
    $id = 'PARK IDs: bahnhofgarage;';
}

// Create Park Bahnhofgarage
if ($id == 'bahnhofgarage') {
    $completeBahnhof = "//xxx.de/bahnhof.txt";
    if(file_exists($completeBahnhof )) {
        $fp=file($completeBahnhof );
        $Garage = $fp[0];
        $valmpl=explode(" ",$Garage);
        $Bahnhof_Platz =  $valmpl[0];
        $Bahnhof_Tendenz = $valmpl[1];
    }

    $id = $Bahnhof_Platz;
}

return $id;
}
add_shortcode('parking', 'GenerateLOT');

[parking id='bahnhofgarage']

PS: The .txt is working properly retrieving like this: 000 - //bahnhof 27.12.15 12:46:59

For some reason its only displaying the $park == '' text and not the parking lots according shortcode param.

I've used this tutorial: sitepoint.com/wordpress-shortcodes-tutorial/

EDIT: There are 6 parking lots.

EDIT2: Changed park to id on all instances

The problem is that you can't meaningfully use file_exists on remote path. See SO answer to "file_exists() returns false even if file exist (remote URL)" question for details.

You should probably just call file() on that path. It will return FALSE if it encounter an error.

if ($id == 'bahnhofgarage') {
    $completeBahnhof = "//xxx.de/bahnhof.txt";
    $fp=file($completeBahnhof );
    if ($fp !== false) {
        $Garage = $fp[0];
        // rest of code

On a side note, shortcode_atts() is used to provide default values for shortcode attributes, while you seem to be using it as some sort of mapping between shortcode attributes and internal variable names.

Accessing file on remote server inside shortcode is asking for trouble. Just think what will happen if this server is overloaded, slow to respond or not available anymore. You should really access that file asynchronously. If it is located on your server, access it through file-system path.