title: Passing Data from PHP to Python
body: <p>I am currently trying to decide on best way to send data across from a PHP script to a Python script. But please keep reading as I have already looked at existing posts on the subject. Currently I am doing the following as suggested by one of the posts I have read:</p>
  
  <pre><code>Example .php
  $var1 = 2;
  $tmp = exec(/var/www Example.py $var1);
  echo "$tmp";
  
  Example.py
  import sys
  print sys.argv[1]
  </code></pre>
  
  <p>This seems to be working ok. Although it is in the really early stages. 
  Ultimately the PHP script will be sending over a reasonable amount of data generated from an HTML form so I wondered if it was the most efficient way of sending it. </p>
  
  <p>The PHP, HTML and the Python scripts are running on a <a href="http://en.wikipedia.org/wiki/Raspberry_Pi" rel="nofollow"><code>Raspberry Pi</code></a> which is connected via a wired LAN to a laptop. </p>
  
  <p>Ultimately I am going to have to use TCP/IP to read various commands from another desktop that will be sending them out via TCP/IP (I can't change this) so I wondered whether it was better to initialize sockets now and then use this method to also send the data from the PHP script to Python. </p>
  
  <p>I am quite new to this range of languages so I am only looking for advice so that I can then investigate further. I have looked at various other posts but none seem to match what I am trying to do.</p>