fill a form on website?

boy1995

New member
Joined
Jun 17, 2011
Messages
2
Location
Pakistan
Programming Experience
1-3
hello,

how can i make a program that can fill a form on website and also click on submit forum and on the next page it clicked on create order:confused::confused::confused:

here is the forum link that i want to fill

VB.NET:
http://203.215.160.178:8080/photoprinting/main.jsp

Thx in advance
 
Your going to want to send a POST request to that address. I would suggest using WebRequest (System.Net). Below is some sample code from MSDN (How to: Send Data Using the WebRequest Class). If you want I could prob. whip up something for you in the next couple of days.

VB.NET:
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Namespace Examples.System.Net
    Public Class WebRequestPostExample

        Public Shared Sub Main()
            ' Create a request using a URL that can receive a post. 
            Dim request As WebRequest = WebRequest.Create("http://www.contoso.com/PostAccepter.aspx ")
            ' Set the Method property of the request to POST.
            request.Method = "POST"
            ' Create POST data and convert it to a byte array.
            Dim postData As String = "This is a test that posts this string to a Web server."
            Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
            ' Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded"
            ' Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length
            ' Get the request stream.
            Dim dataStream As Stream = request.GetRequestStream()
            ' Write the data to the request stream.
            dataStream.Write(byteArray, 0, byteArray.Length)
            ' Close the Stream object.
            dataStream.Close()
            ' Get the response.
            Dim response As WebResponse = request.GetResponse()
            ' Display the status.
            Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
            ' Get the stream containing content returned by the server.
            dataStream = response.GetResponseStream()
            ' Open the stream using a StreamReader for easy access.
            Dim reader As New StreamReader(dataStream)
            ' Read the content.
            Dim responseFromServer As String = reader.ReadToEnd()
            ' Display the content.
            Console.WriteLine(responseFromServer)
            ' Clean up the streams.
            reader.Close()
            dataStream.Close()
            response.Close()
        End Sub
    End Class
End Namespace
 
Make a bot - I made a bot that clicked the form and counted the tabs and filled in the text in the appropriate place. Combine keypress with mouse move commands, and you have it wrapped. Of course its a few weeks development..
 
On hand not at this time. I am actually working on an API for my companies services and similar to what @boy1995 posted in the original post our clients need to fill out a form, upload document, etc. The API im working on will be simulating the user filling out the form. This is for a Point-of-Service application suite our company distributes to schools. I'll post some examples as soon as I have working ones available. Obviously ill have to change some of the URL's and Network Credentials but Ill just replace them with something like %URL% or what ever.
 
VB.NET Example of posting data to a URL with sample PHP of receiving the posted data

Thought I would post an update from my last post. This is just for those who are looking for some help in this area. I realize the "topic is old (May)" so it isn't to answer the OP's post, just additional help for those who seek it!

This is a simple way to provide "POST" data to a website.

The following must be imported
Imports System.Net.WebClient
Imports System.Collections
Imports System.Text


The following is simple example of how to post data to a URL

Dim nv As New Specialized.NameValueCollection()
Dim postUrl As String = "http://www.example.com/send.php"

Public Sub Main()
   console.writeline("Preparing Data")
   nv.Add("arg1","value1")
   nv.Add("arg2","value2")
   nv.Add("arg3","value3")
   console.writeline("Sending Data")
   Me.SendPostData(Me.postUrl,nv)
   console.writeline("Complete")
End Sub

Public Sub SendPostData(ByVal url As String, ByVal nvPair As Specialized.NameValueCollections)
   Dim client As New WebClient()
   Dim results As Byte() = client.UploadValues(url, "POST", nvPair)
   console.write(System.Text.Encoding.ASCII.GetString(results))
End Sub


the PHP page would look something like this (simple example only, you should always parse your data and remove or escape injections or any malicious attempts)
PHP:
$arg1 = $_POST["arg1"];
$arg2 = $_POST["arg2"];
$arg3 = $_POST["arg3"];

echo "Submitted data: A1=".$arg1.", A2=".$arg2.", A3=".$arg3."\n";

I hope this can help anyone and/or provide guidance to solving any issues with the code snippet. If anyone has any needs any explanations or further examples or just help in general with this feel free to reply and I would be more then happy to help!

Also more information can be found on MSDN at:
WebClient.UploadValues Method (String, String, NameValueCollection) (System.Net)
 
Last edited:
Back
Top