S
S
Stas Rodjs2017-05-12 11:52:52
PHP
Stas Rodjs, 2017-05-12 11:52:52

The question is how to return result[2], result[1] and result[0] through PHP?

The question is how to return result[2] , result[1] and result[0] through PHP ?

protected String doInBackground(Void... params) {
            String text = BuildConfig.FLAVOR;
            try {
                String[] result = EntityUtils.toString(new DefaultHttpClient().execute(new HttpGet("http://everest-vann.ru/progmob.php?id=" + MainActivity.this.id + "&hash=" + Utils.md5(MainActivity.this.id + "sosibizu"))).getEntity()).replace("\n", BuildConfig.FLAVOR).split("\\;");
                text = result[2] + result[1] + result[0];
                if (Integer.parseInt(result[2]) == 1) {
                    MainActivity.this.sunduk = Boolean.valueOf(true);
                }
                if (Integer.parseInt(result[1]) == 1) {
                    MainActivity.this.tour = Boolean.valueOf(true);
                }
                if (result[0].equals("ok")) {
                    MainActivity.this.race = Boolean.valueOf(true);
                }
                result[0] = EntityUtils.toString(new DefaultHttpClient().execute(new HttpGet("http://everest-vann.ru/prog.php?id=888")).getEntity()).replace("\n", BuildConfig.FLAVOR);
                return text;
            } catch (Exception e) {
                return "ez";
            }
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fortop, 2017-05-12
@Anton_MD

.replace("\n", BuildConfig.FLAVOR).split("\\;")

You just need to build the string in reverse order.
To begin with, find out what BuildConfig.FLAVOR
is . presumably the data should be formatted like this
<?php

$data = [
    '0\\;',
    '1\\;',
    '2\\;'
];

$text  = imlode('\\;', $data);  //операция обратная .split()
echo $text;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question