title: Executing Python script from PHP and insert in mysql
body: <p>I have a php script that executes a python script and returns the data back and it is stored in mysql. It's working fine but when the data is stored in the database it inserts an additional blank row. My question would be, how could I make so that it stores only the actual data I recieve.</p>
  
  <p>This is part of the python script</p>
  
  <pre><code>
  ##ser.write(sync)
      ser.write(counters)
      a = ser.read(30)
      state = binascii.hexlify(a)
      asd = re.sub(rb'([0-9, a-z, A-Z])(?!$)', rb'\1,', state)
      url = 'http://127.0.0.1/sastest/meters.php'
      x = requests.post(url, data = asd)
      print(asd)
  </code></pre>
  
  <p>And this is from the PHP</p>
  
  <pre><code>
      passthru("meters.py");
  
      $incomingData = file_get_contents("php://input");
  
  
      $qry1 = "INSERT INTO machtest(data)
                  values('".$incomingData."')";
  
      mysqli_query($conn,$qry1);
  </code></pre>