HTTP POST from VB app to PHP script

M

majik92

Hello,

I'm in the process of rewriting a program I wrote in LUA to VB.NET.
So, I am still learning the language (VB). I just have a question...

I have a windows form called "mainPage". I want to connect to the
Internet while loading. I know that I have to put the code in the Load
event for the form. Basically I want the app to send a value (latest =
1) to a remote PHP script (http://www.example.com/latest.php) using
the HTTP POST method.

I've tried using Visual Studio 2005's help topics with not luck...

I was hoping someone could help me here. Thank you.
 
J

Jeff Johnson

I'm in the process of rewriting a program I wrote in LUA to VB.NET.

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005,
which has dropped .NET from its name) are off-topic here.

Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.

For questions specific to the VB.NET language, use this group:
microsoft.public.dotnet.languages.vb

Please note that things like controls and data access, which have their own
subgroups in the Classic VB hierarchy, are not language-specific in .NET, so
you should look for groups like these:
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
 
M

Mike Williams

I'm in the process of rewriting a program I wrote in LUA
to VB.NET. So, I am still learning the language (VB).

You've got me confused now. That's three different languages you've quoted.

Mike
 
A

Alcibiade

Hello,

I'm in the process of rewriting a program I wrote in LUA to VB.NET.
So, I am still learning the language (VB). I just have a question...

I have a windows form called "mainPage". I want to connect to the
Internet while loading. I know that I have to put the code in the Load
event for the form. Basically I want the app to send a value (latest =
1) to a remote PHP script (http://www.example.com/latest.php) using
the HTTP POST method.

I've tried using Visual Studio 2005's help topics with not luck...

I was hoping someone could help me here. Thank you.

Hi, I had same problem.
Try to look here http://snipurl.com/1ew5a
 
M

majik92

I'm in the process of rewriting a program I wrote in LUA to VB.NET.

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005,
which has dropped .NET from its name) are off-topic here.

Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.

For questions specific to the VB.NET language, use this group:
microsoft.public.dotnet.languages.vb

Please note that things like controls and data access, which have their own
subgroups in the Classic VB hierarchy, are not language-specific in .NET, so
you should look for groups like these:
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)

sorry, i won't reply on microsoft.public.vb.general.discussion anymore
about vb.net


You've got me confused now. That's three different languages you've quoted.

Mike

sorry, i meant to right " I am still learning the language
(VB.NET)"...

Hi, I had same problem.
Try to look herehttp://snipurl.com/1ew5a

sorry, i can't read italian, but thx anyway
 
B

Branco Medeiros

maji wrote:
I'm in the process of rewriting a program I wrote in LUA to VB.NET.
So, I am still learning the language (VB). I just have a question...

wellcome aboard...
I have a windows form called "mainPage". I want to connect to the
Internet while loading. I know that I have to put the code in the Load
event for the form. Basically I want the app to send a value (latest =
1) to a remote PHP script (http://www.example.com/latest.php) using
the HTTP POST method.
<snip>

To send an http request, you'll probably want to use the UploadString
method of the System.Net.WebClient class.

Note, however, that if you want your form to paint itself *before*
actually connecting the web, you'll probably prefer to send your
request from the FormShown event instead of using the Load event.

HTH.

Regards,

Branco.
 
A

Alcibiade

sorry, i can't read italian, but thx anyway

No problem:
in vb6 I used winsock control, in vb.net you can use tcpclient.
I sent following data(some parameters have to be changed: script path,
server path, filename, file content):

POST /www/amico.php HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/msword, */*
Referer: http://127.0.0.1/www/
Accept-Language: it
Content-Type: multipart/form-data;
boundary=---------------------------7d52ee2010028a
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)
Host: 127.0.0.1
Content-Length: 41702
Connection: Keep-Alive
Cache-Control: no-cache

-----------------------------7d52ee2010028a
Content-Disposition: form-data; name="MAX_FILE_SIZE"

300000
-----------------------------7d52ee2010028a
Content-Disposition: form-data; name="userfile"; filename="E:
\Documents
and Settings\Evs\Desktop\157930540.jpg"
Content-Type: image/pjpeg

This is a test, I'm not a picture but only text
 

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