Managed C++ or C# .NET, Downloading from rapidshare?
- by cruisx
I am trying to download a file from rapidshare via C++ .NET but I'm having a bit of trouble.
The address used to be "https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi" but that no longer works, does anyone know what the new one is?
The code works but the file size is always 1KB, I don't think its connecting to the right server.
private: void downloadFileAsync(String^ fileUrl)
{
String^ uriString;
//fileUrl = "http://rapidshare.com/files/356458319/Keeping.Up.with.the.Kardashians.S04E10.Delivering.Baby.Mason.HDTV.XviD-MOMENTUM.rar";
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));
}