Urgent matter

Started by
4 comments, last by matchu 13 years, 11 months ago
How ya' doin', people i wanted to on how can create a program in c++ to ask the user input a set of numbers, and then i copy them to the browser to autofill some designated forms( i.e: name, age .....) i really need it to complete my program and i don't know how to do it P.S: iam still learning in c++
Advertisement
Assuming the Web page you need to fill in is actually on a site and not just local...

The simplest way to do it is to just launch the browser with a constructed URL in which you pass the parameters (a GET request):

http://www.example.com/foo.bar?name=John+Smith&age=22


Make foo.bar a CGI script that generates the form. If you are using PHP, for example, it might look like this:

    <html>    <head>    ...    </head>    <body>    ...    <form action="submit.php" method="post">    <input type="text" name="name" value="<?php echo $_GET['name']; ?>"/>    <input type="text" name="age" value="<?php echo $_GET['age']; ?>"/>    ...    <input type="submit" value="Submit"/>    </form>    ...    </body>    </html>


This generates a form with whatever <input> fields you want and fills the fields with the appropriate values captured from the URL.

Make sure you take URL encoding into account if you have special characters in your input, and replace spaces with plus signs.
actually this is not what i meant, i meant that is there a way to copy the the text to the clipboard or something and then when the user clicks on the beginning of the form, it will automatically fill it

it should behave exactly like this macro but i want to implement it in c++

var WshShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep(1000);
WshShell.SendKeys("John Doe");
WshShell.SendKeys("{TAB}");
WshShell.SendKeys("22");
WshShell.SendKeys("Male");
WshShell.SendKeys("aaa@aaa@aaa.com");


my friend made this one in &#106avascript, if u can also tell me how did he do it, i will heavily appreciate it.
Hm sounds to me that you are trying to do some
bot who will fill forms for you.
Make sure this is legal!

For the jscript part I do not know the context but I
think if it is written in jscript it should be embedded
into the site with the form in it.
For this reason it is simple to get access to the fields.
I do not know if there is an interface in your browser that
allows other programs to control it. If there is one than you
have to read its manuals.
If not, this would be very complicated.
Another possibility would be to write your own "browser" that
will fill in the form for you.
how to do it in a created browser, and how to create a browser

this is totally legal by the way
You could look into GreaseMonkey it's a &#106avascript engine that allows you to run &#106avascript &#111;n a page without being part of the page. You can script it so when a certain page loads, it autofill the form. This plugin is for Firefox, but i think someone told me it also exists for chrome and/or safari.<br><br>Hope that helps!

This topic is closed to new replies.

Advertisement