Java
Chilkat2 Java
HTTP Download from URL with IP Address and Port
See more HTTP Examples
Downloads a file from a URL using an IP address and port.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
http.setRequestHeader("Host", "chilkatsoft.com");
String localFilePath = "/temp/hamlet.zip";
try {
http.download("http://107.180.46.206:80/hamlet.zip", localFilePath);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println("OK!");
}
}