I am trying to pass a complicated dict into a Python requests.
dict={
'form':'parse_category',
'category':{
'category':1,
'text':'cat',
'plural_text':'cats'
},
'sources':[1,2,3,4,5,6]
}
category=requests.post('http://localhost/trigger.php',json=dict)
print category.text
I would like to get a nice multidimensional $_POST variable on trigger.php
Desired result:
$_POST=[
'form'=>'parse_category',
'category'=>[
'category'=>1,
'text'=>'cat',
'plural_text'=>'cats'
],
'sources'=>[1,2,3,4,5,6]
];
I learned that I need to use json=dict or some type of json encoded variable. What method do I use to get the JSON data on the PHP side? $_POST and $_GET return empty.