Filling out forms remote

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Radium

    Filling out forms remote

    Is it possible to fill out a form on an foreign website.
    E.g. is it possible to fill out the google form from a php script
    and then initialize the search?

    Thx

    Axel


  • lorento

    #2
    Re: Filling out forms remote

    Radium wrote:[color=blue]
    > Is it possible to fill out a form on an foreign website.
    > E.g. is it possible to fill out the google form from a php script
    > and then initialize the search?[/color]

    Yes...just copy form code, and change the form action. Its not about
    php its just html code.

    e.g for google:
    <form action=http://www.google.com/search>
    <input type=text name=q>
    <input type=submit value=Search>
    </form>

    regards,

    Lorento
    --




    Comment

    • Radium

      #3
      Re: Filling out forms remote

      Yes, but what if the website with the forms uses sessions.
      For example bank accounts logins often open sessions, as soon es you open
      the website
      with the login form. Is it possible to handle this situation with php....

      One would have to load the website like a browser with php, and then fill
      out the forms,
      redirect the output of the website to a real user browser.

      Thx in advance

      Axel


      "lorento" <laurente1234@y ahoo.com> schrieb im Newsbeitrag
      news:1149311495 .069169.155680@ i40g2000cwc.goo glegroups.com.. .[color=blue]
      > Radium wrote:[color=green]
      >> Is it possible to fill out a form on an foreign website.
      >> E.g. is it possible to fill out the google form from a php script
      >> and then initialize the search?[/color]
      >
      > Yes...just copy form code, and change the form action. Its not about
      > php its just html code.
      >
      > e.g for google:
      > <form action=http://www.google.com/search>
      > <input type=text name=q>
      > <input type=submit value=Search>
      > </form>
      >
      > regards,
      >
      > Lorento
      > --
      > http://www.mastervb.net
      > http://www.immersivelounge.com
      > http://www.padbuilder.com
      >[/color]


      Comment

      • Csaba  Gabor

        #4
        Re: Filling out forms remote

        Radium wrote:[color=blue]
        > Is it possible to fill out a form on an foreign website.
        > E.g. is it possible to fill out the google form from a php script
        > and then initialize the search?[/color]

        Two appoaches that you can take:
        1. The standard way is using http://php.net/curl and friends: You
        could examine the html for the page and then manually construct the
        string for the form that you wish to submit. The page examination may
        either be done beforehand to determine its form (as with google, whose
        requirements are straighforward) or on the fly (if there is information
        the server sends that needs to be returned). This approach will break
        if the page in question relies on javascript.

        2. If you are on windows, you can use http://php.net/com: You can
        bring up a copy of InternetExplore r ($ie=new
        COM("InternetEx plorer.Applicat ion") - see
        http://php.net/manual/class.com.php) and work directly with the DOM.
        That is, you can fill out the real live form, submit it, and the answer
        comes back to the $ie COM object. This is a more powerful paradigm,
        but not for the faint of heart.

        The documentation says you shouldn't do this (when running php server
        side. PHP CLI is fine) and that all sorts of mean, nasty, and ugly
        things will happen if you do, but you can. However, there is a
        limitation which I do consider significant when doing this server side:
        the proper way to do this kind of thing (web page sequencing, that is)
        is to use event driven programming (ie. you submit the page, it loads,
        and when it's finished loading the appropriate php function gets called
        - see http://php.net/com-event-sink).

        The thing that happens is that your web server runs under security
        restrictions. Specifically, COM objects are limited in what they can
        do. In particular, COM objects are not allowed to interact with the
        system at large, nor are they allowed to interact with other running
        programs. These restrictions are understandable and reasonable since
        your server is supposed to be running in a sandbox. However, PHP goes
        too far and doesn't allow event sinking with IE in this instance. It
        appears that this is a bug with PHP because if you use VBScript in the
        same way at this point (indeed, if you have PHP call VBScript at this
        point), then that VBScript's IE can be event driven, no problem, even
        within the sandbox. The only recourse that I have found is to use
        polling (ugh!).

        Csaba Gabor from Vienna

        Comment

        • Radium

          #5
          Re: Filling out forms remote

          Wow, will take a month to get through all those possibilities.. .

          Thx man!

          Axel


          "Csaba Gabor" <danswer@gmail. com> schrieb im Newsbeitrag
          news:1149324567 .626654.152140@ y43g2000cwc.goo glegroups.com.. .[color=blue]
          > Radium wrote:[color=green]
          >> Is it possible to fill out a form on an foreign website.
          >> E.g. is it possible to fill out the google form from a php script
          >> and then initialize the search?[/color]
          >
          > Two appoaches that you can take:
          > 1. The standard way is using http://php.net/curl and friends: You
          > could examine the html for the page and then manually construct the
          > string for the form that you wish to submit. The page examination may
          > either be done beforehand to determine its form (as with google, whose
          > requirements are straighforward) or on the fly (if there is information
          > the server sends that needs to be returned). This approach will break
          > if the page in question relies on javascript.
          >
          > 2. If you are on windows, you can use http://php.net/com: You can
          > bring up a copy of InternetExplore r ($ie=new
          > COM("InternetEx plorer.Applicat ion") - see
          > http://php.net/manual/class.com.php) and work directly with the DOM.
          > That is, you can fill out the real live form, submit it, and the answer
          > comes back to the $ie COM object. This is a more powerful paradigm,
          > but not for the faint of heart.
          >
          > The documentation says you shouldn't do this (when running php server
          > side. PHP CLI is fine) and that all sorts of mean, nasty, and ugly
          > things will happen if you do, but you can. However, there is a
          > limitation which I do consider significant when doing this server side:
          > the proper way to do this kind of thing (web page sequencing, that is)
          > is to use event driven programming (ie. you submit the page, it loads,
          > and when it's finished loading the appropriate php function gets called
          > - see http://php.net/com-event-sink).
          >
          > The thing that happens is that your web server runs under security
          > restrictions. Specifically, COM objects are limited in what they can
          > do. In particular, COM objects are not allowed to interact with the
          > system at large, nor are they allowed to interact with other running
          > programs. These restrictions are understandable and reasonable since
          > your server is supposed to be running in a sandbox. However, PHP goes
          > too far and doesn't allow event sinking with IE in this instance. It
          > appears that this is a bug with PHP because if you use VBScript in the
          > same way at this point (indeed, if you have PHP call VBScript at this
          > point), then that VBScript's IE can be event driven, no problem, even
          > within the sandbox. The only recourse that I have found is to use
          > polling (ugh!).
          >
          > Csaba Gabor from Vienna
          >[/color]


          Comment

          • Jerry Stuckle

            #6
            Re: Filling out forms remote

            Radium wrote:[color=blue]
            > Yes, but what if the website with the forms uses sessions.
            > For example bank accounts logins often open sessions, as soon es you open
            > the website
            > with the login form. Is it possible to handle this situation with php....
            >
            > One would have to load the website like a browser with php, and then fill
            > out the forms,
            > redirect the output of the website to a real user browser.
            >
            > Thx in advance
            >
            > Axel
            >
            >[/color]

            Radium,

            That's the hard way. CURL can handle it just fine.

            And please don't top post.


            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Mladen Gogala

              #7
              Re: Filling out forms remote

              On Sat, 03 Jun 2006 11:15:15 +0200, Radium wrote:
              [color=blue]
              > Wow, will take a month to get through all those possibilities.. .[/color]

              It's still much simpler then LWP.

              --


              Comment

              Working...