junky123 has asked for the wisdom of the Perl Monks concerning the following question:

I have written a perl script to query a database and get some field values. I now want to use this data to populate an existing form of a third party vendor. Is there a way this can be achieved ?
  • Comment on display data on an existing third party form

Replies are listed 'Best First'.
Re: display data on an existing third party form
by brian_d_foy (Abbot) on Feb 25, 2005 at 21:03 UTC

    Tools such as WWW::Mechanize can automate form submissions and web interactions. If that is too much power for you, LWP::UserAgent and HTTP::Request can put together a form submission for you. In a pinch, CGI can even form a URL with form values. See the documentation of each one for examples.

    --
    brian d foy <bdfoy@cpan.org>
Re: display data on an existing third party form
by cbrandtbuffalo (Deacon) on Feb 25, 2005 at 21:17 UTC
    Those should work as long as the vendor page isn't using a bunch of javascript. Even if they are, you may still be able to hack something together, but javascript can be problematic for WWW::Mechanize.
Re: display data on an existing third party form
by ww (Archbishop) on Feb 25, 2005 at 21:42 UTC

    Use of WWW:Mechanize, suggested above is certainly good advice but take heed of cbrandtbuffalo's note. Many, many webmasters try to offload some of the cost (server cpu cycles, bandwidth when a required field is not filled in, etc) of the form validation (or even untainting, which is spectacularly UNwise) onto the client, via javascript. So you need to be prepared for problems.

    And forgive me if this is excess-suspicion, but your words

    "..to populate an existing form of a third party vendor"
    may not mean what I fear they might, but if you're talking about using that vendor's bandwidth, etc, for your own purposes, you're talking "rude," to saying nothing of "actionable!"

    In fact, in the US in this post 9/11 era, that might even be criminal.

      I have a vendor whose form I need to fill with data from another database that I have. The third party application has been licensed to me and it exists on my network. I need to fill this once every week so instead of getting the data and filling it manually, I wanted to automate the process. Instead of asking vendor's developers, I wanted to do it so it is useful to everyone in my group.
Re: display data on an existing third party form
by artist (Parson) on Feb 25, 2005 at 21:04 UTC
    Third Party Vendor's Form can call your script to get the data via providing 'next' or 'previous' submit buttons. If you are trying to submit the data to some Internet form, you can use WWW::Mechanize or similar mechanism.
Re: display data on an existing third party form
by Tanktalus (Canon) on Feb 25, 2005 at 22:50 UTC

    It's not entirely clear to me at this point what type of form you're looking to fill. Is it a web form, or some other form? Say a PDF form?

    Please be more explicit.

    (This type of problem is what B2B and XML are supposed to solve ...)

Re: display data on an existing third party form
by ahde (Initiate) on Feb 26, 2005 at 05:16 UTC
    If WWW::Mechanize isn't what you want, try Samie (Simple Automation Module For Internet Explorer) Or if the form isn't in a browser, (like a VB app) Perl::GUITest might do it for you, although it's pretty low level.