-
-
Save anonymous/8c128bdab19b44eec2f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpURLConnection connection; | |
URL url = new URL("https://api.cryptsy.com/api/v2/" + params); | |
connection = (HttpURLConnection) url.openConnection(); | |
params += "&nonce=" + System.currentTimeMillis() / 1000L; | |
connection.setRequestMethod("POST"); | |
connection.setRequestProperty("Content-Type", | |
"application/x-www-form-urlencoded"); | |
connection.setRequestProperty("Content-Length", | |
Integer.toString(params.getBytes().length)); | |
connection.setRequestProperty("Content-Language", "en-US"); | |
String sign = generateHMAC(params); | |
connection.setRequestProperty("Sign",sign); | |
connection.setRequestProperty("Key",pubKey); | |
connection.setUseCaches(false); | |
connection.setDoOutput(true); | |
//Send request | |
DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); | |
wr.writeBytes(params); | |
wr.close(); | |
System.out.println("Sent"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment