Android 端 :
private static String urlString = "http://192.168.10.20:8080/xampp/nfcdemo/readjson.php";
private String jsonStr = "[{'USERID':'Peter','EAN':'1234567891234','PRURL':['http://localhost:8080','http://localhost:8080']}]";
List<NameValuePair> entities = new ArrayList<NameValuePair>();
entities.add(new BasicNameValuePair("json", jsonStr));
HttpClient client = new DefaultHttpClient();
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params,100000);
HttpConnectionParams.setSoTimeout(params, 100000);
HttpPost post = new HttpPost(urlString);
post.setParams(params);
post.setEntity(new UrlEncodedFormEntity(entities, "UTF-8"));
HttpResponse resp = client.execute(post);
Php 服务器端:
<?php
$_POST['json']
>