I am attempting to POST from python to php using requests.post
however $_POST
returns NULL or empty in php.
My PHP should output the request so I can loop through it.
Python
# Import JSON data into POST
def create():
#print(json.dumps(thisisjson, indent=4))
#print(thisisjson)
headers = {'Content-Type': 'application/json', 'Accept':'application/json'}
r = requests.post(url='https://URL/import.php', data=json.dumps(thisisjson), verify=True, headers=headers)
print(r.status_code)
print(r.headers)
print(r.text)
create()
PHP
<?php var_dump(json_decode($_POST, true)); ?>
Sample data
[
{
"Work_order": 123
},
{
"Work_order": 1234
},
{
"Work_order": 12345
}
]