Forum Moderators: coopster

Message Too Old, No Replies

editing source code of an url

         

rprish

7:38 am on Jan 19, 2011 (gmt 0)

10+ Year Member



Hi

I got to develop an online form filling agent

My idea is to have a website grab the url and from there, edit the source code( that is, put values in the fields automatically) and submit the form.

Is this possible..If yes how

Shingetsu

10:57 am on Jan 19, 2011 (gmt 0)

10+ Year Member



Depends on the method... If it's GET, all u do is add to the URL the variables and jump to the receiver. If it's post, you might have to ask to download the page and add a function that will put get code in value=...
If it's post and you don't know the field names u can't. U can also make ur form go directly to the register with post method if you know the names... I'll Ned a button and hidden predefined fields.

Shingetsu

1:01 pm on Jan 19, 2011 (gmt 0)

10+ Year Member



heres an example
your form page
<form method="POST" action="reciever site">
<input type="hidden" ID="ID of the first part of the ender page form" name="name of the first part of the ender page form" value="value that you want" />
<repeat as needed...>
<input type="submit" value="send automated" />
</form>

on the reciever page
it recieves the code u sent, and since the name and id are the same, he treats them as if they were the original ones.

rocknbil

5:50 pm on Jan 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your answer lies in curl, your program logic would do something like this.

- get the form URL. Parse it out line by line to get the names of the form fields, looking for "name="

- compile a POST string filling the values, similar to what's mentioned above.

- use curl and assign a POST method to the curl.

- read the response for errors.

A word of warning, these types of requests often generate from a need for a form spam bot or someone trying to get rich/lots of inbound links quick and using you to do it, if this is the directive of the project you are marching down the road of "bad mojo." If this is the case, run away.