java.io.IOException: Server hat HTTP-Antwortcode zurückgegeben: 403 für URL

Ich möchte die MP3-Datei von folgender URL herunterladen: "http://upload13.music.qzone.soso.com/30671794.mp3". Ich habe immer java.io.IOException: Der Server hat den HTTP-Antwortcode 403 für die URL zurückgegeben. Aber es ist in Ordnung, wenn Sie die URL mit dem Browser öffnen. Unten ist ein Teil meines Codes:

BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
    URL url = new URL(link);

    URLConnection urlConn = url.openConnection();
    urlConn.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");

    String contentType = urlConn.getContentType();

    System.out.println("contentType:" + contentType);

    InputStream is = urlConn.getInputStream();
    bis = new BufferedInputStream(is, 4 * 1024);
    bos = new BufferedOutputStream(new FileOutputStream(
    fileName.toString()));​

ann mir jemand helfen? Danke im Voraus

Antworten auf die Frage(10)

Ihre Antwort auf die Frage