Code copied from a foreign website
Delphi Source:
http: = Tidhttp.create (nil);
http. Handleredirects: = true;//allows head to turn
http. ReadTimeout: = 5000;//Request time-out setting
http. Request.contenttype: = ' application/json ';//set content type to JSON
Jsontosend: = Tstringstream.create (' {' name ': ' Peter Pan '} ');//Create a variable that contains JSON data
Jsontosend.position: = 0;//Set the flow position to 0
Memo1.Lines.Text: = http. Post (' http://www.website.com/test.php ', jsontosend);//Receive Post data with memo control return
Jsontosend.free; http.free;//run out and remember to release
PHP Source:
<?php
$value = Json_decode ($_post);
Var_dump ($value);
?>
Http://blog.sina.com.cn/s/blog_722bc92e0101i7gp.html
Http://stackoverflow.com/questions/12175952/delphi-tidhttp-post-json
Delphi-idhttp-post JSON usage good