import requests
json_data = {'data':'Strawberry'}
requests.post(url='***********************', json=json_data)
<?php
$post_data = json_decode(file_get_contents('php://input'), true); //Receive JSON
$data = $post_data["data"];
define("TESTFILE","./all_data.txt");//Write the received value to a txt file
$fh = fopen(TESTFILE, "w");
fwrite($fh,$data);
fclose($fh);
?>
data = requests.get('***********************/all_data.txt')
print(data.text)
Recommended Posts