dongxiaolin2801 2019-05-05 13:34
浏览 221

请求标头中的HTTP cookie(_ga)

Hello,

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:

{
    @Override
    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.

NOTE:

The __test value is from Google chrome.

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 delta降尺度方法,未来数据怎么降尺度
    • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
    • ¥15 再不同版本的系统上,TCP传输速度不一致
    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程