Post form with php cURL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lostcracker
    New Member
    • Mar 2008
    • 4

    Post form with php cURL

    cracker as in cookie.. its a long story.. Anyways, so glad I found this place.. should be fun!

    trying to submit a form with php script. here is the form
    [php]<form name="userdata_ template_form" method="post" onsubmit="this. submit1.disable d=true;" action="LZwEzgH FOthxE8iMdzKIX; _lv=3">
    <input type="hidden" name="link" value="answer">
    <input type="hidden" name="did" value="10827AbP hAg">
    <input type="hidden" name=".crumb" value="sd3UDKut Z">
    <input type="hidden" name="textarea" value="userdata input">
    <input type="hidden" name="e" value="0">
    <input type="submit" class="button" value="Submit" name="submit1">
    [/php]
    and here is my script.. so far I've put in to many hours on this.. Im more mainframe and unix scripting so php curl is new.. enjoy the laugh[php]
    <?php
    $ch = curl_init();
    curl_setopt($ch , CURLOPT_RETURNT RANSFER,1);
    curl_setopt($ch , CURLOPT_COOKIEF ILE, "/temp/cookie.txt");
    curl_setopt($ch , CURLOPT_URL,"ht tp://10.80.2.115/userdata.html") ;
    curl_setopt ($ch, CURLOPT_POSTFIE LDS, "link=answer&di d=10827AbPhAg&. crumb=sd3UDKutZ
    &textarea=userd atainput&e=0&su bmit1=submit");
    $result = curl_exec ($ch);
    curl_close ($ch);
    echo $result;
    ?>[/php]
    what I get is when the page loads the text area is populated with "userdatain put" as it should be but the submit button is not "click" - if figured cURL was posting so the button would not require "clicking"

    I have also tried it from the command line with no verbose errors

    Many thanks..

    Cracker
    Last edited by ronverdonk; Mar 28 '08, 10:58 PM. Reason: code tags!!
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Don't know much about curl. The code doesn't look very familiar so I'm not sure how useful we'll be. Anyway, welcome to the Scripts!

    2 things:
    I am presuming it's just a typo, but someone will post it soon: Is that the end of your form? You need </form> at the end.
    Also, include you posted code in the correct tags. (These are located just above where you post - same line as bold, italic etc...)

    Comment

    • lostcracker
      New Member
      • Mar 2008
      • 4

      #3
      hey there thank you for the input.. let me clarify my question and use the code tags.. sry bout that

      I'm trying to submit a http form via a php cURL script

      here is the HTML code
      [HTML]
      <form name="userdata_ template_form" method="post" onsubmit="this. submit1.disable d=true;" action="LZwEzgH FOthxE8iMdzKIX; _lv=3">
      <input type="hidden" name="link" value="answer">
      <input type="hidden" name="did" value="10827AbP hAg">
      <input type="hidden" name=".crumb" value="sd3UDKut Z">
      <input type="hidden" name="textarea" value="userdata input">
      <input type="hidden" name="e" value="0">
      <input type="submit" class="button" value="Submit" name="submit1">
      </form>
      [/HTML]

      and here is the script
      [PHP]
      <?php
      $ch = curl_init();
      curl_setopt($ch , CURLOPT_RETURNT RANSFER,1);
      curl_setopt($ch , CURLOPT_COOKIEF ILE, "/temp/cookie.txt");
      curl_setopt($ch , CURLOPT_URL,"ht tp://10.80.2.115/userdata.html") ;
      curl_setopt ($ch, CURLOPT_POSTFIE LDS, "link=answer&di d=10827AbPhAg&. crumb=sd3UDKutZ
      &textarea=userd atainput&e=0&su bmit1=submit");
      $result = curl_exec ($ch);
      curl_close ($ch);
      echo $result;
      ?>
      [/PHP]

      when I run this script via the command line I get no errors but the form isn't submitted.

      If I save the script as a .php file and open it in a web browser I can see the data is placed in the right field however the form is not submitted..

      any thoughts?
      Thanks

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Originally posted by Faisal Shah
        Thanks Bro.

        Well, I don't understood one thing.. php is todays technology :)
        More faster and i believe easier then why people go to other languages such as perl and cgi and all that?

        Can any one clarify it to me? Is there is any reason that those languages have some more special features then php???

        Thanks..
        FAISAL!
        Your question has nothing to do with the problem at hand, so do not hyjack this thread!!

        Thread will be split.

        moderator

        Comment

        • lostcracker
          New Member
          • Mar 2008
          • 4

          #5
          I guess no one understands my question.. let me give more input

          The form code you see if from a web page on a remote server google.com

          My server is running the cURL script to submit data to the remote server. The data is sent to the server but it doesn't seem to get processed. I know it can be done because spammers do it. I'm not spamming though.. I want to automate some google aps functions

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            As you guessed rightly: I still do not see the goal of this excercise.

            I cannot see the purpose of that form. You have a submit button, but that button is diabled, so the form cannot and will not be sent anywhere. In casse the submit button would be enabled the form would be posted to something called "LZwEzgHFOthxE8 iMdzKIX;_lv=3", whatever that is.

            Just to give us the basic idea: how do you envisage the form data (at the CLIENT (but generated by google.com ???) is to be transferred to the php cURL routine (at your SERVER)?

            Ronald

            Comment

            • lostcracker
              New Member
              • Mar 2008
              • 4

              #7
              Originally posted by ronverdonk

              Just to give us the basic idea: how do you envisage the form data (at the CLIENT (but generated by google.com ???) is to be transferred to the php cURL routine (at your SERVER)?

              Ronald
              the form data is static on google.. they are just static HTML pages with form code in them. I look at the code and use it in my script

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                You forgot to reply on the first part of my post. When you try to do that you will see your problem.

                Static HTML pages on a server are never executed on the server, they are sent to the client and executed there. So, look again at the first part of my previous post.

                I bet you don't even need that html form from Google, you can just execute your curl script and it will run. You'd need at least your own form, that directs to your own curl script, to do that.

                Ronald

                Comment

                Working...