Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InputStream in = null;
- String s = "";
- String api_sig = new String(Hex.encodeHex(DigestUtils.md5("api_key" + API_KEY + methodauth.getMobileSessionpassword" + PASSWORD + "username" + USERNAME + SECRET)));
- try {
- HttpURLConnection c;
- s = String.valueOf(isNetworkAvailable());
- URL url = new URL("http://ws.audioscrobbler.com/2.0/");//?method=auth.getMobileSession&api_key=" + API_KEY + "&username=" + USERNAME + "&password=" + PASSWORD + "&api_sig=" + api_sig);
- c = (HttpURLConnection) url.openConnection();
- //c.setRequestMethod("POST");
- //c.setRequestProperty("method", "auth.getMobileSession" );
- //c.setRequestProperty("api_key", API_KEY);
- //c.setRequestProperty("username", USERNAME);
- //c.setRequestProperty("password", PASSWORD);
- //c.setRequestProperty("api_sig", api_sig);
- //c.setDoOutput(true);
- //c.setDoInput(true);
- //DataOutputStream ds = new DataOutputStream(c.getOutputStream());
- //ds.writeBytes(data);
- //ds.flush();
- //ds.close();
- c.connect();
- //s = String.valueOf(c.getResponseCode());
- in = new DataInputStream(c.getInputStream());
- //InputStreamReader isr = new InputStreamReader(is);
- //BufferedReader reader = new BufferedReader(isr);
- s= in.toString();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- return e.toString();
- }
- finally {
- return s;
- }
Add Comment
Please, Sign In to add comment