当在Java中访问的网页,我的PHP页面的主体变成约JavaScript错误 [英] When accessing webpage in java, the body of my php page becomes error about javascript
问题描述
这是我试图访问网页:
http://ssbmapp.byethost18.com/demo.php
不过,不管如何我尝试访问它在我的Android Studio项目中,我得到这个在页面主体:
< HTML和GT;
<身体GT;
<脚本类型=文/ JavaScript的SRC =/ aes.js>< / SCRIPT>
<脚本>
功能toNumbers(D){
变种E = []; d.replace(/(..)/克,功能(D){e.push(parseInt函数(D,16))});返回电子邮件}功能toHex(){为(VAR d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e=\"\",f=0;f<d.length;f++)e+=(16>d[f]?\"0\":\"\")+d[f].toString(16);return e.toLowerCase()} VAR a=toNumbers(\"f655ba9d09a112d4968c63579db590b4\"),b=toNumbers(\"98344c2eee86c3994890592585b49f80\"),c=toNumbers(\"f816ad55200eac766df3e7c7ba7c6897\");document.cookie=\"__test=\"+toHex(slowAES.decrypt(c,2,a,b))+\";过期=星期四,31日 - 12月37格林尼治标准时间23点55分55秒;路径= /; location.href =http://ssbmapp.byethost18.com/demo.php?ckattempt=1;
&LT; / SCRIPT&GT;
&LT; NOSCRIPT&gt;这网站需要JavaScript的工作,请启用Javascript在浏览器中,或使用的JavaScript支持℃的浏览器; / NOSCRIPT&GT;
&LT; /身体GT;
&LT; / HTML&GT;
下面是我的项目中code:
@覆盖
保护无效doInBackground(虚空...... PARAMS){ 尝试{
JSON字符串= Jsoup.connect(http://ssbmapp.byethost18.com/demo.php).ignoreContentType(真).execute()体()。 Log.d(粉碎,JSON);
}赶上(MalformedURLException的E){
e.printStackTrace();
}赶上(IOException异常五){
e.printStackTrace();
} 返回null; }
它看起来像原来的PHP页面不会立即产生JSON对象。相反,它会产生一个JavaScript code,最终使另一个HTTP请求并得到JSON。如果您使用Web HTTP请求/响应嗅探器,如 http://web-sniffer.net/ 你会看到现场的反应是完全一样的对视了一眼你的code为打印。
This is the webpage I am trying to access: http://ssbmapp.byethost18.com/demo.php
But, regardless of how I attempt to access it in my android studio project, I get this for the body of the page:
<html>
<body>
<script type="text/javascript" src="/aes.js" ></script>
<script>
function toNumbers(d) {
var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("f816ad55200eac766df3e7c7ba7c6897");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";location.href="http://ssbmapp.byethost18.com/demo.php?ckattempt=1";
</script>
<noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript>
</body>
</html>
Here is the code in my project:
@Override
protected Void doInBackground(Void... params) {
try {
String json = Jsoup.connect("http://ssbmapp.byethost18.com/demo.php").ignoreContentType(true).execute().body();
Log.d("smash", json);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
It looks like the original PHP page does not produce the JSON object immediately. Instead, it produces a javascript code that eventually makes another HTTP request and gets the JSON. If you use a Web HTTP request/response sniffer such as http://web-sniffer.net/ you will see that the site response is exactly the same as the one your code is printing.
这篇关于当在Java中访问的网页,我的PHP页面的主体变成约JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!