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

Ajax form (?)

Discussion in 'PHP & Perl' started by Ceg3xow, Jul 10, 2011.

  1. Ceg3xow

    Ceg3xow Newbie

    Joined:
    Jul 6, 2011
    Messages:
    18
    Likes Received:
    1
    Hi, i'm building a bot using PHP just to get experience, I'm a newbie, this bot gets a random topic on a forum I frequent, finds it title and post something related, I got everything done, but when I try to post, I can't find a form on the HTML, I made it login, find the topic, get a suitable answer but I can't post, this is what I get on the page source on the message field:

    Code:
    <textarea name="message" id="messageContent" rows="18" wrap="virtual" tabindex="2"></textarea>  <div class="left formSend-content"> </span> <span class="format-option-last"> <img src="">&nbsp; <a href="javascript:bbstyle(-1, 'post', 'messageContent', 'addbbcode')"  id="closemarks">FECHAR MARCAS</a> </span> <br> <textarea name="message" id="messageContent" rows="18" wrap="virtual" tabindex="2"></textarea> </div>   <div class="right formSend-send"> <span id="formSubmit"> <a href="#" class="formSubmit" tabindex="3"></a> </span> </div>
    and this is the function I tracked on the page source:

    Code:
    //Enviar formulário de nova mensagem     $(".formSubmit").click(function(e){         e.preventDefault();         e.stopPropagation();             if ($("#messageContent").attr("value") == undefined || $("#messageContent").attr("value").length < 2){             alert("A mensagem precisa ter no mÃ*nimo 2 caracteres.");             $("#messageContent").focus();             return false;         }else {             $("form[name=post]").submit();             return false;         }     });
     
  2. BugFixed

    BugFixed Junior Member

    Joined:
    Sep 24, 2010
    Messages:
    130
    Likes Received:
    39
    • Thanks Thanks x 1
  3. Ceg3xow

    Ceg3xow Newbie

    Joined:
    Jul 6, 2011
    Messages:
    18
    Likes Received:
    1
    I will try that ! thanks
     
  4. chatmasta

    chatmasta Junior Member

    Joined:
    Sep 1, 2007
    Messages:
    122
    Likes Received:
    38
    ^ Not necessary

    AJAX calls can be replicated by curl even though it does not execute the javascript itself. You just need to emulate what the javascript is doing. To see what it is doing, download a FF plugin called Live HTTP Headers (google it). Go to the website, open Live HTTP Headers, and submit the form. You will see all the requests happening. You need to find the right one - usually a POST request - and execute that with curl.

    Boom, instant AJAX.
     
  5. awesom-o

    awesom-o Newbie

    Joined:
    Jun 17, 2011
    Messages:
    13
    Likes Received:
    0
    Occupation:
    Computer Engineering Student
    Location:
    Germany
    I've looked for such a plugin for months :) I think all i need to do was being a member of bhw, i'm going to be bhw-addict.
     
  6. ekologic

    ekologic Registered Member

    Joined:
    Oct 25, 2010
    Messages:
    64
    Likes Received:
    2
    Occupation:
    Wanna be an autoblogger
    Location:
    in facebook
    one of the best method is to install firebug and use it.
    P.s firebug is a plugin for firefox
     
  7. EJIKK

    EJIKK Newbie

    Joined:
    Aug 2, 2011
    Messages:
    17
    Likes Received:
    0
    or devel console in Chrome.