title: Pass and get variables between PHP and R
body: <p>I have a php file that runs as a cron job. That file gets all the football games of the day with curl once per day and stores them in a database. So the table <code>nextgames</code> has the following:</p>
  
  <blockquote>
    <p>HomeTeam, AwayTeam, League, Odds of various things such as 1,X,2 under etc (doesn't matter).</p>
  </blockquote>
  
  <p>For each of those games I want to run some R code. So basically, inside the php script I need to run a command like:</p>
  
  <pre><code>exec("Rscript &lt;path&gt;/myscript.R");
  </code></pre>
  
  <p>My first question is: In that script I need to pass HomeTeam, AwayTeam and League. So how do I pass those variables to the script?</p>
  
  <p>My second question is: That script has as a result a 7x7 matrix that represents the probabilities for each of the teams score 0, 1, 2, 3, 4, 5 or 6 goals. How do I get that data back to php?</p>
  
  <p>PS: I can't install rapache to the webhost I am atm. </p>