Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1008168 - Test getting response text from 403 error [WORKS when cloudflare is enabled]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (427L/4K/12K).

!7

p {
  HttpURLConnection connection = cast new URL("http://ai1.lol/1002157/raw").openConnection();
  int code = connection.getResponseCode();
  print("Response code: " + code);
  
  InputStream stream = connection.getErrorStream();
  if (stream == null)
    stream = connection.getInputStream();
  print("Response:");
  print(utf8streamToString(stream));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

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: 300 / 350
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1008168 & http://1008168.tinybrain.de