Results 1 to 7 of 7
  1. #1
    lght306 is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Get me some TIPS to start with please !

    I am going to write a java program to check the availability of a product in a webpage.
    If the product is available then my program will start to buy.

    My question is how to mimic the shopping process in java ?
    my idea is :

    use java to send the http post request the web server , but how can I know the post request format ?

    Would someone clarify my solution or get me a way to start.

    Thanks

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,574
    Rep Power
    23

    Default Re: Get me some TIPS to start with please !

    how to mimic the shopping process
    Can you explain what that is? What steps are in the "shopping process"?

    the post request format
    You need to understand how a browser takes the info from a <FORM tag in an HTML file and creates the HTTP POST request.

    There are tools for looking at what a browser generates for its HTTP requests.
    A simple way would be to save the html page, modify the <FORM tag to use a GET vs POST, load the page in a browser, fill in the form and press submit. The URL the browser sends will show the format of the FORM data.

  3. #3
    lght306 is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Re: Get me some TIPS to start with please !

    Quote Originally Posted by Norm View Post
    Can you explain what that is? What steps are in the "shopping process"?


    You need to understand how a browser takes the info from a <FORM tag in an HTML file and creates the HTTP POST request.

    There are tools for looking at what a browser generates for its HTTP requests.
    A simple way would be to save the html page, modify the <FORM tag to use a GET vs POST, load the page in a browser, fill in the form and press submit. The URL the browser sends will show the format of the FORM data.
    the shopping process would be : if the product is available , I add it to the cart then click check it out. The website will load a new page and ask me to login
    then ask for address and card number.

    How can I mimic those action ?
    My silly idea is : mimic the http post request ( like clicking the check out button ) , send it by java, then get the response . Is it a general way to do so ?

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,574
    Rep Power
    23

    Default Re: Get me some TIPS to start with please !

    A java program can mimic a browser. The java program can do a HTTP GET for the html with the <FORM, read the html and then send an HTTP POST request to the server by "filling in" the fields in the form and then read the resonse from the server.

    Many servers look for this type of program and will not respond to them if they do not think there is a person with a browser at the client site of the transaction.
    If it is your server you are talking to, you should be able to get it to respond as you want.

  5. #5
    lght306 is offline Member
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Re: Get me some TIPS to start with please !

    Quote Originally Posted by Norm View Post
    A java program can mimic a browser. The java program can do a HTTP GET for the html with the <FORM, read the html and then send an HTTP POST request to the server by "filling in" the fields in the form and then read the resonse from the server.

    Many servers look for this type of program and will not respond to them if they do not think there is a person with a browser at the client site of the transaction.
    If it is your server you are talking to, you should be able to get it to respond as you want.
    I know that other's buyying program has already worked. So, do they use another algorithm ? Would you suggest a possible way ?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,574
    Rep Power
    23

    Default Re: Get me some TIPS to start with please !

    Would you suggest a possible way ?
    The java program can do a HTTP GET for the html with the <FORM, read the html and then send an HTTP POST request to the server by "filling in" the fields in the form and then read the resonse from the server.

  7. #7
    jing-yi is offline Member
    Join Date
    May 2011
    Posts
    35
    Rep Power
    0

    Default Re: Get me some TIPS to start with please !

    Ya, it is too broad to discuss here... What I can imagine is it should be a bunch of jsp or htm/html pages...

Similar Threads

  1. Replies: 1
    Last Post: 01-18-2011, 06:27 PM
  2. Recursion tips?
    By MojoeMAN in forum New To Java
    Replies: 1
    Last Post: 01-02-2011, 05:36 AM
  3. i need some tips on this question
    By reeveliew in forum New To Java
    Replies: 13
    Last Post: 06-15-2010, 05:29 PM
  4. Tips needed
    By adz06 in forum New To Java
    Replies: 5
    Last Post: 12-07-2009, 01:35 AM
  5. Need some tips.
    By PVL268 in forum New To Java
    Replies: 4
    Last Post: 02-27-2009, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •