Auto Post Using Javascript

Hi there, a few weeks ago I was doing research about auto post from webpage to paypal payment page. The basic idea is the visitor fill the form, then when the visitor submit the form we will store visitor data input to database. Once data stored in database the page will be automatically redirected to paypal website. It’s pretty easy, we will use JavaScript to do auto post. I wanna make this article as simple as possible, I just wanna show how to do auto post with Javascript.

1. Database

We will use simple database for this experiment, single table with 4 columns ( id, first_name, last_name, package).

CREATE TABLE `javascriptpost`.`sales` (
`id` INT( 6 ) NOT NULL AUTO_INCREMENT ,
`first_name` VARCHAR( 30 ) NOT NULL ,
`last_name` VARCHAR( 30 ) NOT NULL ,
`package` VARCHAR( 10 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM ;

2. Form (index.php)

First we need a basic form for user to input, data will be posted to post.php.


	
		

3. Post.php

In post.php we will retrieve the posted data from index.php and store the data to database.
Once data stored, the pages will be redirected to paypal website.

We will use javascript syntax to do autopost,


post.php








Home




	
        

Thank you for booking

Now we will redirect to payment page

11 Replies to “Auto Post Using Javascript”

  1. Interesting script, it took me a while to figure out the MySQL connect as I failed to change mysql_select_db(“javascriptpost”, $con);
    to mysql_select_db(” name of database here “, $con);

    Also one has to change the $con = mysql_connect(“localhost”,”root”,” your password “);
    to $con = mysql_connect(“localhost”,” your database user name “,” your password “);

    Also one needs to edit the name=”business” value=”[email protected]” to your own merchant – vender email account for the correct thoroughfare, aprt from this it’s smooth sailing.

  2. Just realized by changing mysql_select_db(“javascriptpost”, $con);
    to mysql_select_db(” name of database here “, $con); I’ve essentially dropped java autoposting which defeats the purpose of running this script, could you enlighten me on how to run the java snippet at the top of this tutorial as it wouldn’t allow me to connect when ran as (“javascriptpost”, $con) , thanks.

    1. Actually the Javascript here works only for autosubmit the form named paypal on post.php

      So the idea is visitor input the data on index.php, then data posted to post.php, we do storing data to database in here. Once its done it will run the javascript automatically.

      Look for this code at post.php
      When the body onload, it will trigger the subm() function with after waiting 2500milisecond.

      1. Yeah I get you, pretty nifty. I was interested in the function subm() {
        document.getElementById(‘paypal’).submit();
        attribute as I’ve got a bot that needs to retrieve sports statistics from a form based DB.

        I’m tiring to get it to post the info from a temp file then auto submit, wait then with either jquery or cURL retrieve the stats info then store in temp dump for further data manipulation.

        The challenge for me is getting the php and java to operate with each other as I’m not as confident with java as I am with php. Thanks for the tutorial, it may come in handy some day.

  3. I’d like to make an auto poster for posting comment on my utube channel but there is that mean old real human check now it’s like impossible I know more python if it’s really hard in java

Leave a Reply to Jay Cancel reply

Your email address will not be published. Required fields are marked *