Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- URL siturl = new URL("https://web.expasy.org/cgi-bin/protparam/protparam");
- //opening the siturl connection
- HttpURLConnection conn = null;
- conn = (HttpURLConnection)siturl.openConnection();
- conn.setRequestMethod("POST");
- conn.setFollowRedirects(true);
- char[] data=new String("prot_id=P05130&sequence=&mandatory=").toCharArray();
- conn.setRequestProperty("Content-length", String.valueOf(data.length));
- conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
- conn.setDoOutput(true);
- conn.setDoInput(true);
- //setting the output condition to true for printing the contents
- OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
- // used to convert character to bytes
- wr.write(data);
- //System.out.println(data);
- wr.flush();
- wr.close();
- // Get the response
- BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- String line=null;
- while((line=rd.readLine())!=null){
- System.out.println(line);
- }
- }catch(Exception e){
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment