我曾经得到以下对php请求的响应
响应:
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
我的代码:
URL url = new URL("http://myappdemo.com/payumoney/payUmoneyHashGenerator.php");
// get the payuConfig first
String postParam = postParams[0];
byte[] postParamsByte = postParam.getBytes("UTF-8");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setInstanceFollowRedirects(false);
conn.setRequestProperty("Content-Length",
String.valueOf(postParamsByte.length));
conn.setDoOutput(true);
conn.getOutputStream().write(postParamsByte);
InputStream responseInputStream = conn.getInputStream();
StringBuffer responseStringBuffer = new StringBuffer();
byte[] byteContainer = new byte[1024];
for (int i; (i = responseInputStream.read(byteContainer)) != -1; ) {
responseStringBuffer.append(new String(byteContainer, 0, i));
}
Log.e("tag", "doInBackground: "+ responseStringBuffer.toString());
还尝试了凌空反应是
BasicNetwork.performRequest:意外的响应代码301 for http://myappdemo.com/payumoney/payUmoneyHashGenerator.php
请帮帮我。 在此先感谢。
答案 0 :(得分:0)
this.application = consultService.getApplicationSubject()
.map((item: Application) => {
// Sort the activity list by the last update time
if (item != null && item.workflow != null && item.workflow.activityList != null) {
item.workflow.activityList.sort((leftSide, rightSide): number => {
if (leftSide.lastUpdate < rightSide.lastUpdate) return 1;
if (leftSide.lastUpdate > rightSide.lastUpdate) return -1;
return 0;
});
}
return item;
});
用于永久URL重定向。应更新使用接收响应的URL的当前链接。尝试在链接中使用301 Moved Permanently
使用https://