title: How to GET request into json data file
body: <p>I want to load data in a json file with an html GET request:</p>
  
  <pre><code>http://www.example.com/xxx/?id={device}&amp;time={time}&amp;snr={snr}&amp;station={station}&amp;lat={lat}&amp;lng={lng}&amp;rssi={rssi}&amp;data={data}&amp;avgSnr={avgSnr}
  </code></pre>
  
  <p>On the server side is this my index.html file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;
     &lt;title&gt;Demo Model&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;?php
       $_id = $_GET["id"];
       $_time = $_GET["time"];
       $_snr = $_GET["snr"];
       $_station = $_GET["station"];
       $_lat = $_GET["lat"];
       $_lng = $_GET["lng"];
       $_rssi = $_GET["rssi"];
       $_data = $_GET["data"];
       $_avgSnr = $_GET["avgSnr"];
  
       if ( $fl = fopen('data.json','a')) {
         fwrite($fl,"\"data\": { \"id\" : \"". $_id . "\", "
                               ."\"data\" :\"" . $_data . "\", "
                               ."\"from\" :\"" . $_station . "\", "
                               ."\"lat\" :\"" . $_lat . "\", "
                               ."\"lng\" :\"" . $_lng . "\" }\n" );
         fclose($fl);
       }
    ?&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The data.json file stays empty, can someone explain me why? </p>
  
  <p>Thanks anyway!</p>