Flood Data in PHP form

718 views Asked by At

I want to flood some random data in a PHP form. Can I do it?

I want to actually test my website and database ofcourse. All I want to know that is it capable of handling if multiple registration is done at same time.

2

There are 2 answers

6
Mike Stratton On BEST ANSWER

First, create pages that echo data from source.

data1.php
data2.php
data3.php
data4.php

Second create a php page that will do the following:

  1. Create variables from data sources.
  2. Pass variables into array.
  3. Randomly select a specific variable.
  4. Echo results into page.

    // variables from data
    $var1 = file_get_contents('data1.php');
    $var2 = file_get_contents('data2.php');
    $var3 = file_get_contents('data3.php');
    $var4 = file_get_contents('data4.php');

    // pass variables into array
    $data = array($var1, $var2, $var3, $var4,);

    $dkey = array_rand($data); // random selection
    echo 'Data: '.$data[$dkey]; // echo selection

Your finished code will look like this:

<?php
$var1 = file_get_contents('data1.php');  
$var2 = file_get_contents('data2.php');   
$var3 = file_get_contents('data3.php');   
$var4 = file_get_contents('data4.php');   

$arr = array($var1, $var2, $var3, $var4,);  

$key = array_rand($arr);    
echo 'Data: '.$arr[$key];   
?>
0
m c On

cURL is a very good tool to fill up a (POST) form a submit it. You may find a cURL library implementation in PHP, so you can use a "familiar" language to get random data, but you can also use the command line version.