我試圖從Android運行一個PHP腳本。我嘗試了1000種方法,沒有任何工作。請任何想法嗎? 我不在乎,如果使用GET或POST,我只是希望它的工作T_T 隨着Web瀏覽器(http://www.myweb.net/[email protected]&pass=123456)的作品,但沒有Android項目...Android HTTPGET HTTPOST -
最簡單的: //安卓
HttpPost httppost;
HttpClient httpclient;
try {
httppost = new HttpPost(
"http://www.myweb.net/[email protected]&pass=123456");
httpclient = new DefaultHttpClient();
httpclient.execute(httppost);
} catch (Exception e) {
}
// PHP
if(isset($_GET['mail']) && isset($_GET['pass'])){
mail($_GET['mail'],"remember",$_GET['pass']);
}else {
echo "=(";
}
if(isset($_POST['mail']) && isset($_POST['pass'])){
mail($_POST['mail'],"remember",$_POST['pass']);
}else {
echo "=(";
}
謝謝你,
我用:
<uses-permission android:name="android.permission.INTERNET" />
和:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
試試這個[執行一個HTTP POST與HttpClient的請求(http://www.androidsnippets.com/executing- a-http-post-request-with-httpclient) – 2013-03-21 04:37:22