MtG Card Data Gatherer

[ // 'user_agent' => '', // 'protocol_version' => 1.1 //]]); function get_card_data($set, $num) { $fp = fopen('https://api.magicthegathering.io/v1/cards?set=' . $set . '&number=' . $num, 'r'); $meta = stream_get_meta_data($fp); $content = stream_get_contents($fp); fclose($fp); var_dump($meta); var_dump(json_decode($content, true)['cards'][0]); } if (isset($_REQUEST['query'])) { $q = $_REQUEST['query']; $template = $_REQUEST['format']; $lines = explode("\n", $q); echo '
';
    foreach ($lines as $line) {
        $parts = explode(' ', $line);

        echo $engine->render($template, $parts);
        get_card_data($parts[0], $parts[1]);
        echo "\n";
    }
    echo '

'; } ?>
>