Connecting to my torrent client (I use it for legal stuff only!)
Hey
It summer and I am messing around with a little project of mine.
I am building a program (maybe app later on) to remotely
handle my torrents (only free torrents!).
For example:
If I type this url (http://username:password@iport/gui/?...&s=torrentlink)
in the browser the movie gets in my client/starts downloading. I want this to happen by my program.
Code :
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class Connection {
private String ip;
private String port;
private String username;
private String password;
public Connection(String ip, String port, String username, String password) {
this.ip = ip;
this.port = port;
this.username = username;
this.password = password;
connect(this.ip, this.port);
}
private void connect(String ip, String port) {
try {
URL myURL = new URL("http://username:password@iport/gui/?action=add-url&s=torrentlink");
URLConnection myURLConnection = myURL.openConnection();
myURLConnection.connect();
}
catch (MalformedURLException e) {
System.out.println("failed connection");
}
catch (IOException e) {
System.out.println("failed connection");
}
} }
This is what I already have, i am sure it connects but it doesn't add the torrent to my program
Does somebody know what I need to add for it to work?
I use it for legal stuff only!
Thanks in advance!