Python to php server Get Data
<p>Ok I'm a little confused here I need to send data to a php server and receive back a response from it example: a raspberry pi sends a unit id and the server returns json file. </p>

<p>I have tried this .py code</p>

<pre><code>import requests
import json

url = 'http://localhost/updateContent.php'
payload = {"device":"gabriel","data_type":"data","zone":1,"sample":4,"count":0,"time_stamp":"00:00"}
headers = {'content-type': 'application/json'}

response = requests.post(url, data=json.dumps(payload), headers=headers)
</code></pre>

<p>but obviously this post the data but I don't get a response from the php server</p>

<p>What kind of protocal should I use for this?</p>

<pre><code>response = requests.post(url, data=json.dumps(payload), headers=headers)
</code></pre>

<p>To output the result of your post you have to print out <code>response.text</code> <code>print(response.text);</code></p>

php python json raspberry-pi