Libraryless. Click here for Pure Java version (427L/4K/12K).
1 | !7 |
2 | |
3 | p { |
4 | HttpURLConnection connection = cast new URL("http://ai1.lol/1002157/raw").openConnection(); |
5 | int code = connection.getResponseCode(); |
6 | print("Response code: " + code); |
7 | |
8 | InputStream stream = connection.getErrorStream(); |
9 | if (stream == null) |
10 | stream = connection.getInputStream(); |
11 | print("Response:"); |
12 | print(utf8streamToString(stream)); |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008168 |
Snippet name: | Test getting response text from 403 error [WORKS when cloudflare is enabled] |
Eternal ID of this version: | #1008168/5 |
Text MD5: | aee9b631a96203e80c2fa91597464c03 |
Transpilation MD5: | 6cf2a7ebe57da1c8df7cbe55c19b700f |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-04-29 17:00:13 |
Source code size: | 371 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 473 / 583 |
Version history: | 4 change(s) |
Referenced in: | [show references] |