2011-01-03 4 views
0

C++ .NET을 통해 rapidshare에서 파일을 다운로드하려고하는데 문제가 있습니다.Managed C++ 또는 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"); 

} 
+1

1kB 파일의 내용은 무엇입니까? – CodesInChaos

+0

이 언어는 C++/CLI가 아니고 C++ .NET이 아니며 확실히 "Managed C++"가 아닙니다. 마지막 용어는 VS2002 및 VS2003의 일부인 "Managed Extensions for C++"의 약자로만 사용되며 VS2005에서 C++/CLI가 나올 때 사망했습니다. –

답변

2

Rapidshare는 최근 구조를 완전히 철저히 조사했습니다. 그 1kb 파일은 아마도 당신이 잘못하고있는 것을 알려주는 HTML 텍스트 일 ​​것입니다.

편집

당신은 Rapishare API를 사용하고 있습니까? 왜냐하면 당신의 코드는 내가 그들의 문서 페이지에서 보는 것처럼 보이지 않기 때문이다.

+0

폴더의 파일이 ArcadeBackground.png로 표시되지만 사진을 열면 그림이 손상/손상된 것입니다. – cruisx

+0

메모장으로 열면 cruisx

+2

그래서 자바 스크립트 리디렉션이고 새 쿼리 문자열의 매개 변수 중 일부는 아마도 시간 제한이 있습니다. 먼저 다운로드 한 다음 새 URL을 구문 분석하고 두 번째 요청을해야합니다. –

관련 문제