2

I have a website in which I have a several php forms that I would like to fill out with auto generated content (for the purposes of exercising different content the user could submit). I would like to write a client side application that enables me to do so.

Is there any way either using webtoolkit, java script etc of doing this?

2
  • what kind of "different content" you want to submit? What is purpose of this exercise? Commented May 14, 2010 at 15:44
  • The kind of applications this can be used in is not limited to spam, for instance working with 3rd party custom authentication for network gateways may require this kind of form submission. Commented Jun 3, 2015 at 19:39

5 Answers 5

4

If you are already familiar with php, why not use php on the "client side" as well? You can use the Client URL package to submit POST data to a web form. Example:

<?php
$ch = curl_init();
$data = array('name' => 'phpnoob', 'address' => 'somewhere');

curl_setopt($ch, CURLOPT_URL, 'http://localhost/url/to/your/php/form.php'); // use the URL that shows up in your <form action="...url..."> tag
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_exec($ch);
?> 
Sign up to request clarification or add additional context in comments.

2 Comments

I don't mind the downvote, but I'd be grateful for an explanation so that I can improve my answer...
I believe it's on ethical grounds because they think phpnoob is going to use this information to spam. I strongly disagree since there is no indication of that and at stack overflow provide answers to questions, period, without going too much into unrelated ethic discussions. However downvotes are completely subjective so there is nothing you can do about it.
2

It would probably be better, more stable and more efficient to mock a submission by sending data directly into your application. PHPUnit is a great framework for unit testing PHP applications.

But yes, it would be possible to write a client side submission too. You could also write Selenium tests, which use JavaScript to interact with your page.

Comments

0

if you name your form using the id attribute, you can call the javascript function

document.myform.submit();

where myform is the name of that form.

Comments

0

You could have an onload event attached to the body element which would submit the forms automatically.

<body onload="document.form1.submit();document.form2.submit();">
    <form id="form1" action="url" method="post">

    </form>

    <form id="form2" action="url" method="post">

    </form>
</body>

Of course this would be completed better using jQuery or another API.

Comments

0

IF you are php programmer then you might not want any javascript answer. the best solution to this is

1.USE A PROXY like paros or HTTP analyser they will give u the insight how site's form is structued

2.notE down the forms POST OR GET VALUE and their SYNTAX FROM THE HTTP analyzer or paros proxy.

read this tutorial it is the best tutorial out there

http://www.html-form-guide.com/php-form/php-form-submit.html

4.change the content of $_post or $_get according to their structure which you have noted down in

paros or HTTP analyser

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.