0

C++ .NET 経由で RapidShare からファイルをダウンロードしようとしていますが、少し問題があります。

アドレスは以前は「https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi」でしたが、機能しなくなりました。新しいアドレスが何であるか知っている人はいますか? コードは機能しますが、ファイル サイズは常に 1KB です。適切なサーバーに接続しているとは思えません。

private: void downloadFileAsync(String^ fileUrl)
{
    String^ uriString;

    uriString = "https://ssl.rapidshare.com/premzone.html";//"https://ssl.rapidshare.com";

    NameValueCollection^ postvals = gcnew NameValueCollection();
    postvals->Add("login", "bob");
    postvals->Add("password", "12345");
    // postvals->Add("uselandingpage", "1");

    WebClient^ myWebClient = gcnew WebClient();
    array<unsigned char>^ responseArray = gcnew array<unsigned char>(10024);
    responseArray = myWebClient->UploadValues(uriString, "POST", postvals);

    StreamReader^ strRdr = gcnew StreamReader(gcnew MemoryStream(responseArray));

    String^ cookiestr = myWebClient->ResponseHeaders->Get("Set-Cookie");

    myWebClient->Headers->Add("Cookie", cookiestr);
    //myWebClient->DownloadFileCompleted += gcnew AsyncCompletedEventHandler(myWebClient->DownloadFileCompleted);

    myWebClient->DownloadFileAsync(gcnew Uri(fileUrl),"C:\\rapid\\"+Path::GetFileName(fileUrl));   
}


private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
    downloadFileAsync("http://rapidshare.com/files/440636806/ArcadeBackground.png");

}
4

1 に答える 1

2

Rapidshare は最近、その構造を完全に見直しました。その 1kb ファイルは、おそらく HTML テキストであり、何が間違っているかを示しています。

編集

Rapishare APIを使用していますか? あなたのコードは、ドキュメンテーション ページに表示されているものとはまったく似ていないためです。

于 2011-01-03T21:20:56.977 に答える