Solved

Automatically fill in a form fields after a form has been submitted.

Posted on 2004-08-06
16
230 Views
Last Modified: 2010-04-06
What i'm trying to do is fill in a form on another website after a form has been filled out and submitted on my own website.  I do not have access to the source code of the remote website so i hope that won't stop me.  I put this in the general web language section because i didn't know which language i would need to use exactly.  I'm not even sure if i should be using a web language.  Any suggestion would be most appreciated and an example would be helpful if this can be done.

If anyone needs more detail on what i'm trying to do exactly i can get more specific.

Thanks in Advance.
Adam
0
Comment
Question by:Adam409
  • 4
  • 4
  • 4
  • +2
16 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 11739905
Hi

I must say this would be a bit difficult with a web language. I'm familiar with PHP and you could probably stretch it a bit to make it work, but I would recommend getting a copy of Perl, learning some basic syntax, and posting in that area (particularly inquire about LWP::UserAgent

Others may be able to stretch web languages to make it work, and I can try with PHP if you want me to... (Of course, with almost any language, there lies the problem of finding out when a form is being submitted on your site. The problem of this lies in the fact that you can constantly query your web server, but that would waste bandwidth. I believe there are programs out there that can automate things for you, if you want them)

Regards,
Zyloch
0
 

Author Comment

by:Adam409
ID: 11739936
Thanks Zylochs

I do have some Basic Perl Experience... you think that would be the best solution??? If so i will post it there right now.

Adam
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11739948
Well, Perl has great data manipulation and may be the EASIEST solution. The biggest problem lies in the fact of how to know that the user has submitted a form on your website
0
 

Author Comment

by:Adam409
ID: 11740614
Well i think i should expain exactly what i'm trying to do to give you a better idea.

On my website i have clients that use my management system to put up products for sale.  What clients have asked me is if they could use my system to put up products for my site as well as one of my competitors websites that they use as well.  So what needs to be done is when they put an item up on my website they want it to automatically fill in the appropriate fields on my competitors site and submit that as well.  Basically manage 2 systems from one spot.  Obviously being my competitor i don't have access to there source code.  Just my clients management system for my competitor.

Hopefully this make sense and if more clarification needs to be done i am more then willing to provide that information.

Adam
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11740821
I think I see what needs to be done. Ideally, you'd have it in the webpage code. The concept is pretty simple. It depends on what language you feel is best. Personally, I feel Perl would be pretty easy (but it may be possible easily in other languages too), because I know you can use LWP::UserAgent to post stuff.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11740825
To clarify, you can make it with a web language (Perl CGI is what I mean)
0
 
LVL 2

Assisted Solution

by:poopall
poopall earned 100 total points
ID: 11741751
I would use something like ASPTear, which is a free componet, in which you could collect the data on your webiste and then submit it to the other website, as if you had completed it your self. This can also be done by looking betwewn the <form> tags on the other website to see what input fields are being used, and then submitting the data from your web site directly using the date that is required. This assumes that you are not required to view the data on the form onn the other website

Example would be like submitting a query to google lookig for "ASP Tear"

http://www.google.com.au/search?q=asptear&ie=UTF-8&hl=en&meta=


Notice how q=asptear, you would insert this bit and then submit the http requests.

If you dont want to be redirect to or display googles website then use the ASPTear Compenent else just use the link above, but making the changes tht you require






0
 
LVL 9

Assisted Solution

by:waygood
waygood earned 300 total points
ID: 11749623
Have you thought about using the php CURL functions

QUOTE
PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:Adam409
ID: 11749734
I like both the ASPTear and the PHP CURL solutions.  I do have alot more experience with PHP then i do ASP but that isn't a factor really,  just what is best to use.

If anyone had an example using ASPTear or PHP CURL to autofill a form on a remote server based on a form that was submitted on there own that would be ideal just so i could see what is involved with either solution.

Thanks again for all the great ideas.

Adam
0
 
LVL 2

Expert Comment

by:poopall
ID: 11750846
AspTear examples see

http://www.4guysfromrolla.com/webtech/071800-1.shtml

Or you can use XMLHTTP, alrady built into Intertnet Explorer see example below:-



Dim objXMLHTTP, xml
  ' Create an xmlhttp object:
   xml = Server.CreateObject("Microsoft.XMLHTTP")

  ' Version 3.0 of XMLHTTP, use:
  ' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

  ' Opens the connection to the remote server.
  xml.Open ("GET", "http://www.google.com/search?q=web+services", False)      
  ' Actually Sends the request and returns the data:
  xml.Send
  'Display the HTML and Text
  'Response.Write ("<h1>The HTML text</h1><xmp>")
  'Response.Write (xml.responseText)
  'Response.Write ("</xmp>")
Response.Write ("<h1>This is generated results from google using XMLHTTP </h1>")
Response.Write (xml.responseText)
 xml = Nothing
%>
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 100 total points
ID: 11769988
the above code assumes that the page which u r submitting too accepts form values in querystring format .. so it works .. how does ur competitors page work .. i assume .. it must be a normal HTML page with lots of textboxes ... and a submt button .. just check when the submit button is clicked where does the page get sumitted to and is it done in the "GET" format (i.e. r the values seen in the querystring) and not form "POST" ..

the problems with the solution that ur thinking of is that if the other page changes for some reason .. u will have to keep changing ur code ..
0
 
LVL 2

Expert Comment

by:poopall
ID: 11771338
I hear what you are saying, but you dont control the other website, so what is your solution ?
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11771660
one way of doing what he requires is to create a frameset ...
<frameset id="BodyFrameset" rows="30,*" frameborder="0" framespacing="0">
    <frame id="TopHeader" name="TopHeader" src="MyPage.asp" scrolling="no" noresize>
    <frame name="main" src="PageToBeAccessed.asp" frameBorder="no" scrolling="auto">
</frameset>

In the page MyPage.asp .. u could access all the variables of PageToBeaccessed.asp using client side scripting .. assign the required values this way and submit that form by calling the click event of the submit button ..

0
 
LVL 2

Expert Comment

by:poopall
ID: 11788469
Your solution assumes that you don't mind seeing the contents of the other page, I was assuming that the purpose of this solution was to be somewhat stealthy,  even in your example with client side scripting assumes no changes to the other parties website, like change of variable names etc, etc.
0
 

Author Comment

by:Adam409
ID: 11789055
I would like to thank all the people that have sent replies.

I really like the curl approach because i am a better PHP programmer... if someone has some example code using curl other then the stuff that is on the php.net site that is related to what i'm trying to do that could possible help that would be most appreciated.

Thanks again

Adam
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11803233
poopall,
the same assumption of problems with changes in variable names etc. is true in ur suggestion too .. the one using XMLHTTP .. I only suggested this as an alternative when the form accepts inputs as a "POST" instead of "GET"

Adam409
To get a better solution as per ur requirement, U should move this question to a PHP aread or better close this question and start a new one in that area ..
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now