Andorid Webview 如何将数据发布到应用程序/x-www-form-urlencoded [英] Andorid Webview How to POST data to application/x-www-form-urlencoded

查看:57
本文介绍了Andorid Webview 如何将数据发布到应用程序/x-www-form-urlencoded的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Webview 因为我正在加载带有查询字符串周长的网络喜欢

I have a Webview In that I am loading web with Query string perimeters like

String url = map.get("utype") + map.get("sid") + "/login/login.php?"+"&"+"strid" + "=" + map.get("strid")+"&"+"appmod" + "=" + map.get("appmod")+"&" +"ttype" + "=" + map.get("ttype")+"&" +"payp" + "=" + map.get("payp");

我正在 webview 中加载该查询字符串

I am loading that Query string in webview

webView.loadUrl(url);

所以现在使用查询字符串我想将参数发布到 x-www-form-urlencoded

So Now Insted of using Query string I want to POST Parameters to x-www-form-urlencoded

这些是我的参数

strid = map.get("strid");
appmod = map.get("appmod");
ttype = map.get("ttype");
payp = map.get("payp");

我关注了这个但它不起作用

谁能帮我解决这个问题..

can any one help me on this..

我想在 Web 视图中将数据 POST 到 x-www-form-urlencoded

I want to POST data to x-www-form-urlencoded in Web-view

发布后我将加载我的网络服务器(网站).

After posting I it will load my Web-server(website).

更新

我已经为帖子提供了这些值

I have Given these values for post

String postData="strid="+URLEncoder.encode(map.get("strid"), "UTF-8")+
"&appmod="+URLEncoder.encode(map.get("appmod"), "UTF-8")+
"&ttype="+URLEncoder.encode(map.get("ttype"), "UTF-8")+
"&payp="+URLEncoder.encode(map.get("payp"), "UTF-8");

现在添加详细信息后,我已将其提供给 URL

Now after Adding The Details I have given this to at URL

webView.postUrl(url,postData.getBytes());

但是还是不行

谁能告诉我有什么问题

推荐答案

需要调用webView.postUrl(url, encodingData);

值必须使用 URLEncoder.encode(postData, "UTF-8")"BASE64" 编码,具体取决于后端.

Values must be encoded with URLEncoder.encode(postData, "UTF-8") or "BASE64" depends on backend.

如果它不起作用,请确保您的网址格式正确.如果您不确定,您也可以将其分享到此处而无需暴露您的价值观.

If its not working make sure you have url in correct format. You can also share it to here without exposing your values if you are not sure.

这篇关于Andorid Webview 如何将数据发布到应用程序/x-www-form-urlencoded的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆