title: How to call a php script in server from python
body: <p>I am trying to run the php script which is in my server from the python project which is in my local machine. </p>
  
  <p>I have tried following till now</p>
  
  <p>Python Side:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  import subprocess
  import json
  import sys
  import os
  
  def php(script_path):
      p = subprocess.Popen(['php', script_path], stdout=subprocess.PIPE)
      result = p.communicate()[0]
      return result
  
  image_dimensions_json = str(php("http://XXX.XXX.XX.XX/logistic_admin/test1.php"))
  dic = json.loads(image_dimensions_json)
  print str(dic["0"]) + "|" + str(dic["1"])
  </code></pre>
  
  <p>php side:</p>
  
  <pre><code>test1.php
  
  &lt;?php
  echo(json_encode(getimagesize($argv[1])));
  
  ?&gt;
  </code></pre>
  
  <p>But I am facing following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:\folder\test.py", line 20, in &lt;module&gt;
      image_dimensions_json = str(php("http://XXX.XXX.XX.XX/logistic_admin/test1.php"))
    File "D:\folder\test.py", line 16, in php
      p = subprocess.Popen(['php', script_path], stdout=subprocess.PIPE)
    File "C:\Python27\Lib\subprocess.py", line 711, in __init__
      errread, errwrite)
    File "C:\Python27\Lib\subprocess.py", line 948, in _execute_child
      startupinfo)
  WindowsError: [Error 2] The system cannot find the file specified
  </code></pre>