0

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;

    }
Aurélien Thieriot
  • 5,387
  • 2
  • 21
  • 25
Mahone
  • 3
  • 1
  • 1
    welcome to SE. You can just take tour through http://stackoverflow.com/help/how-to-ask. I suggest you to format your code (function toNumbers) to make it more readable. preferably in multiple lines. – Pawan Sep 19 '15 at 12:04
  • Well it would seem that you are barking up the wrong tree (the tree is not android). The trouble is cearly with your php script. For example if someone were to do 'wget http://ssbmapp.byethost18.com/demo.php' the result is a 403 error. It seems like you have some browser based or ip based filtering on it. – e4c5 Sep 19 '15 at 12:29

1 Answers1

1

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.

  • thank you, thats what i was thinking as well. Would there be a way for me to access the data after this http request? – Mahone Sep 19 '15 at 13:42
  • Maybe, although I personally have never done it. Perhaps you should refer to this question: http://stackoverflow.com/questions/2941411/executing-javascript-without-a-browser – Eduardo Javier Huerta Yero Sep 19 '15 at 13:47