I'm using Android Volley SDK on my project.
So, i can send a HTTP request to a PHP Web service.
As long i'm using Bytehost I have to add a cookie to the request.

Here is the code of how I added headers to the request using Volley SDK:

    public Map<String, String> getHeaders() throws AuthFailureError {
        Map<String, String> params = new HashMap<String, String>();
        params.put("Cookie", "_ga=GA1.2.379091755.1552931984; __test=7a00807b28e8ac6198fe3d386efb901e");
        params.put("Host", "justbusesdbs.eb2a.com");
        params.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3");
        params.put("Accept-Encoding", "deflate");
        params.put("Accept-Language", "en-US,en;q=0.9,ar;q=0.8,he;q=0.7,ca;q=0.6");
        params.put("Upgrade-Insecure-Requests", "1");
        params.put("Connection", "keep-alive");
        params.put("Cache-Control", "max-age=0");
        params.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36");
        return params;

I faced this issue:

params.put("Cookie", "_ga=GA1.2.379091755.1552931984; __test=7a00807b28e8ac6198fe3d386efb901e");

The value of __test in Cookie is fixed in my code. And the server reject the request after 4 hours from creating the cookie.
And I have to get a new __test value every 4 hours by myself.


The __test value is from Google chrome.

I need a way to create a value for __test without my intervention.

0 Answers