I want to make a form application that upload torrent file in bytebx.com using my username and password

Could any one help me?

Torrent uploading header request like :


POST /storage HTTP/1.1
Host: bytebx.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:34.0) Gecko/20100101 Firefox/34.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://bytebx.com/storage
Cookie: xxxxxxx
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------1461596626053
Content-Length: 444
Content-Disposition: form-data; name="url"

Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream


i made a request file as below where ccont is my generated login cookiecontainer:

Static rnd As New Random()
        Dim boundary As String = String.Concat(Enumerable.Range(0, 13).Select(Function(x) rnd.Next(3, 9).ToString()))
        'Dim boundary As String = "---------------------------" & DateTime.Now.Ticks.ToString("x")
        Dim req As HttpWebRequest = DirectCast(WebRequest.Create("http://www.bytebx.com/storage"), HttpWebRequest)
        req.Method = "POST"
        req.CookieContainer = ccont
        req.KeepAlive = True
        req.Referer = "http://www.bytebx.com/storage"
        req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:29.0) Gecko/20100101 Firefox/29.0"
        req.ContentType = "multipart/form-data; boundary=" & "---------------------------" & DateTime.Now.Ticks.ToString("x")
        Dim builder As New StringBuilder()
        builder.Append(boundary & vbNewLine & "Content-Disposition: form-data; name=""url""" & vbNewLine & vbNewLine)
        builder.Append(TextBox3.Text & vbCrLf)
        builder.Append(boundary & vbCrLf & "Content-Disposition: form-data; name=""file""; filename=""""" & vbCrLf)
        builder.Append("Content-Type: application/octet-stream")
        ' Footer Bytes
        Dim close As Byte() = Encoding.UTF8.GetBytes("--")
        Dim postHeader As String = builder.ToString()
        'TextBox4.Text = postHeader
        Dim postHeaderBytes As Byte() = Encoding.UTF8.GetBytes(postHeader)
        Dim boundaryBytes As Byte() = Encoding.ASCII.GetBytes(vbCrLf & boundary & "--" & vbCrLf)
        Dim length As Long = postHeaderBytes.Length + boundaryBytes.Length
        req.ContentLength = length
        Dim requestStream As Stream = req.GetRequestStream()
        Dim fulllength As Integer = postHeaderBytes.Length + boundaryBytes.Length
        ' Write out our post header
        requestStream.Write(postHeaderBytes, 0, postHeaderBytes.Length)
        ' Write out the trailing boundary
        requestStream.Write(boundaryBytes, 0, boundaryBytes.Length)
        Dim responce As WebResponse
        responce = req.GetResponse()
        Dim s As Stream = responce.GetResponseStream()
        Dim sr As New StreamReader(s)
        Dim Content As String = sr.ReadToEnd()

ohhh sorry... I did not mentioned something..

textbox3.text = "http://torcache.net/torrent/55282A6D8AA608CAED27B0250605AAE6E0EE2F4F.torrent"

and i also tried

Dim boundary As String = "---------------------------" & String.Concat(Enumerable.Range(0, 13).Select(Function(x) rnd.Next(3, 9).ToString()))

And also tried with this

Dim boundary As String = "---------------------------" & DateTime.Now.Ticks.ToString("x")

but no progress...
Firstly i can login successfully but unable to upload torrent file from remote url.....
textbox3.text contains my remote torrent file url

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.