7/31/2013

python write the json and php read it periodically

python part:

#save your data into python dictionary - Ex. testResultsJson
testResultsJson = {}
fjs = open('/var/www/xxx/state.json','w')
fjs.write(json.dumps(testResultsJson))
fjs.close()


php part:

$file = "/var/www/xxx/state.json";
$obj = json_decode(file_get_contents($file));
#Ex. i want to get the timestamp info from this object.
$timestring =  'Last Updated:'.$obj.'timestamp.';

沒有留言: