1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Trying to automate mass PM on a site using Javascript - puzzling dilemma

Discussion in 'HTML & JavaScript' started by dtang4, Nov 30, 2011.

  1. dtang4

    dtang4 Regular Member

    Joined:
    Apr 7, 2010
    Messages:
    291
    Likes Received:
    43
    I am trying to mass PM thousands of members on this one social networking site.

    Their site has little security, so I am able to replicate the HTML PM submission form locally... submit it... and have the message go through.

    So, for each of the users I scrape, I am trying to auto-generate an HTML PM form, auto-populate the form fields, and then auto-submit the POST form.

    When I auto-submit using Javascript (e.g. "document.forms[$i].submit()"), the form doesn't seem successfully submit. However, if I were to just output the form and then manually click the submit button, the message does go through.

    Any idea why the Javascript submission wouldn't work?

    Thanks.
     
    Last edited: Nov 30, 2011
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    Check with firebug/dragonfly for Javascript possible errors.
     
  3. xpwizard

    xpwizard Junior Member

    Joined:
    Nov 6, 2010
    Messages:
    198
    Likes Received:
    122
    What browser are you using?
    How are you inserting the JS? Are you doing it via the url bar?

    (some browsers like FF don't work/like JS in the url bar).
     
  4. cool0403

    cool0403 BANNED BANNED

    Joined:
    Dec 29, 2008
    Messages:
    565
    Likes Received:
    718
    Its more likely cause on the onsubmit property the form has. I am pretty sure the site has some sort of javascript that runs right before it submits the form , its usually a mix of keyboard,mouse logs associated with the time they were press/move with some sort of algorithm implemented to it .
     
  5. sirgold

    sirgold Supreme Member

    Joined:
    Jun 25, 2010
    Messages:
    1,260
    Likes Received:
    645
    Occupation:
    Busy proving the Pareto principle right
    Location:
    A hot one
    There might be hidden fields containing specific values that are generally used in submit forms in order to prevent 3rd party submissions. Search on the html page for "hidden" that might help.
     
  6. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    Seems inefficient. If you can replicate the form, then why not post directly? Even using CURL would allow you to skip out on the html side and the time cost of javascript.
     
  7. dtang4

    dtang4 Regular Member

    Joined:
    Apr 7, 2010
    Messages:
    291
    Likes Received:
    43
    The form doesn't have any additional hidden fields or onsubmit property. I'm sure of this, because I replicated the form's HTML locally and stripped away all the extraneous code. (When I say locally, I mean I have the HTML file on my own apache localhost. I'm not injecting Javascript or anything via the URL bar into the social network site.)

    The only difference is the message only goes through if I manually click the submit button. If I insert a line of Javascript to submit it automatically, it no longer works.

    I tried cURL, but it wasn't working (maybe for the same reason the javascript didn't work). The time cost isn't a big deal for me. As long as its automated, I don't care if it just runs for a few hours in the background.
     
  8. paincake

    paincake Power Member

    Joined:
    Aug 18, 2010
    Messages:
    716
    Likes Received:
    3,099
    Home Page:
    Well, you can always use Imacros to click the button... I use it for simple tasks quite often instead of coding standalone apps, because it requires less effort
     
    Last edited: Dec 1, 2011
  9. Clinker

    Clinker Newbie

    Joined:
    Sep 29, 2011
    Messages:
    31
    Likes Received:
    4
    The javascript submit should work; have a look here for a live example:

    http : // jsfiddle . net / 5uJmm /

    What you probably do is calling the Javascript before the form is rendered; that trigger a Javascript error and the form is not submitted.
    Check it againg and be sure to call the Javascript after the form declaration.