403 Forbidden with Java but not web browser?

前端 未结 4 1903
陌清茗
陌清茗 2020-11-22 03:08

I am writing a small Java program to get the amount of results for a given Google search term. For some reason, in Java I am getting a 403 Forbidden but I am getting the rig

4条回答
  •  旧时难觅i
    2020-11-22 03:36

    You probably aren't setting the correct headers. Use LiveHttpHeaders (or equivalent) in the browser to see what headers the browser is sending, then emulate them in your code.

提交回复
热议问题