我想在我的应用中发布网络链接,我尝试了以下代码。
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php");
HttpResponse response = httpclient.execute(httppost);
但它不起作用。 帮帮我
答案 0 :(得分:0)
HttpResponse response = (HttpResponse) httpclient
.execute(httpPostRequest);
使用此代码......我希望它对您有用。
请在androidmanifest文件中添加权限
<uses-permission android:name="android.permission.INTERNET" />
答案 1 :(得分:0)
这个怎么样?
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("\http://www.yoursite.com/script.php\");
HttpResponse response = httpclient.execute(httppost);