2012-07-27 94 views
0

我有兩個環節:從Android設備JSON發送到服務器不工作

private static final String url_to_reg_device1 = "http://10.0.2.2/android_connec/regdevice.php"; 
private static final String url_to_reg_device2 = "http://www.something.in/form/regdevice.php"; 

一個是本地主機,另一個是服務器。

當我開始活動時,我創建了一個存儲電子郵件和註冊號的JSON並將其發送到服務器。在服務器端,我解碼JSON記錄並獲取值,並將其存儲在數據庫中。

問題是我的代碼在本地服務器上工作。但是,當我把它上傳在服務器上(到URL中url_to_reg_device2),我得到這個錯誤:JSON對象的正確

"Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject".

+0

您的第二個網址的回覆必須返回一個json ...不是html ....我認爲重寫規則將會添加您的文檔類型。 – silly 2012-07-27 12:02:25

+0

@ Rohit13發佈一些代碼。 – 2012-07-27 12:05:56

+0

我不確定,但首先嚐試將JSON轉換爲JSONStringer並傳遞給服務器。 – 2012-07-27 12:49:07

回答

0

檢查標籤。

+0

你是什麼意思?對不起,但我不明白。 – Rohit13 2012-07-27 14:17:00

相關問題