download file by post data to web server

B

BiT

Hello,

I'm working right now on project in vb.net 2005 for my company, i need the
project to download file from the company web site.
In order to get the file i have to give the site address
http://www.somthing.com and then send to the server post data like
"&d=10202" to get the file.
i've search google and newsgroups but I didn't find anything to solve my
problem, I found this example
http://dotnet.mvps.org/dotnet/code/net/#CookieRequest but i didn't
understand it.
if anyone know a document or other source code or can explain how to do it
i'll be grateful

Thanks
 
B

BiT

first thanks for the answear

i've tried your code but I keep getting back 417 errors form the server
any idea?
 
M

Michel Posseth [MCP]

i've tried your code but I keep getting back 417 errors form the server
any idea?


strange ,,,, "failed expectation" i have never encountered this error
myself


maybe you could post your code here , so we can have a look at it
 
B

BiT

Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

Dim d As Byte() =
System.Text.Encoding.ASCII.GetBytes("?getnzb=Get+NZB&binary%5B%5D=1115165")

Dim res As Byte() = web.UploadData("http://www.newzleech.com/", "POST", d)

the odd thing is i can do it in one HTML code line and it's work perfect:
FORM action=http://www.newzleech.com/?getnzb=Get+NZB&binary[]=1115165
method=post>
<INPUT type=submit value="test" name=getnz>

thanks
 
M

Michel Posseth [MCP]

This wil work ( tested )
Dim web As New System.Net.WebClient()

web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

Dim d As Byte() = {}

Dim byteData As Byte() =
web.UploadData("http://www.newzleech.com?getnzb=Get+NZB&binary[]=1115165&",
"POST", d)

Dim oFileStream As New System.IO.FileStream("bytes.nzb",
System.IO.FileMode.Create)

oFileStream.Write(byteData, 0, byteData.Length)

oFileStream.Close()

i have tested this on my system when i double click the bytes.nzb my news
leecher start downloading 15 files of a supervideo called popeye patriotic
popeye 1957

regards



Michel
 
B

BiT

Michel thanks alot
and once again thanks


Michel Posseth said:
This wil work ( tested )
Dim web As New System.Net.WebClient()

web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

Dim d As Byte() = {}

Dim byteData As Byte() =
web.UploadData("http://www.newzleech.com?getnzb=Get+NZB&binary[]=1115165&",
"POST", d)

Dim oFileStream As New System.IO.FileStream("bytes.nzb",
System.IO.FileMode.Create)

oFileStream.Write(byteData, 0, byteData.Length)

oFileStream.Close()

i have tested this on my system when i double click the bytes.nzb my news
leecher start downloading 15 files of a supervideo called popeye patriotic
popeye 1957

regards



Michel
 
T

the_only_steven

if i want to auto click a button which is on a website can i use the
Post system also then?

the button is java coded and its code is like this
<input type="submit" name="submit" value="submit!">

the submit! is the text that is on the button.


I have tried many things, exept the post system cause i dont really
understand it lol


Thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top