Passing data from PHP to Perl?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • google_nospam@zaft.com

    Passing data from PHP to Perl?

    Thanks in advance for any help. I'm looking for a way to pass data
    from php to perl. Basically, I want to take some dynamic data from a
    database, mixed with user input, then reformat it to make a new set of
    variables and pass those variables to a perl script to do all the hard
    work.

    Anyway, I can handle the database connectivity, and putting variables
    together, but how do I pass the variables to perl?

    I have seen other comments on this, but many suggest bringing the data
    back to php to print out. Unfortunately, the output is more than text
    - it includes pictures. So obviously, I need the perl script to output
    as if it was called from a browser.

    I really want to avoid any intermediate pages if possible.

    Thanks,
    Shane

  • John Bokma

    #2
    Re: Passing data from PHP to Perl?

    wrote:
    [color=blue]
    > Thanks in advance for any help. I'm looking for a way to pass data
    > from php to perl. Basically, I want to take some dynamic data from a
    > database, mixed with user input, then reformat it to make a new set of
    > variables and pass those variables to a perl script to do all the hard
    > work.
    >
    > Anyway, I can handle the database connectivity, and putting variables
    > together, but how do I pass the variables to perl?
    >
    > I have seen other comments on this, but many suggest bringing the data
    > back to php to print out. Unfortunately, the output is more than text
    > - it includes pictures. So obviously, I need the perl script to
    > output as if it was called from a browser.[/color]

    You can't. A page with pictures are at least 2 objects from a browser's
    point of view, so you can't return 2+ objects as one object (unless you
    render the page to one object yourself).
    [color=blue]
    > I really want to avoid any intermediate pages if possible.[/color]

    You either return data to PHP, or you have the PHP program redirect you
    to the perl program. You can't have something in between.

    I would drop PHP all together. You can do the database connectivity in
    Perl, etc. Or the other way around. What is it you can do in Perl but
    can't in PHP ( ok, not loosing time on bad documentation and weird side
    effects ).

    --
    John MexIT: http://johnbokma.com/mexit/
    personal page: http://johnbokma.com/
    Experienced programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html

    Comment

    • google_nospam@zaft.com

      #3
      Re: Passing data from PHP to Perl?

      I could code it in perl, but PHPis soooo easy to manipulate anything
      from a database, and I want to create many interfaces to this perl
      program in the future, so if this is possible, I could potentially save
      myself a lot of time working with PHP.

      Now when you say "Have the PHP program redirect you to the perl
      program", that sounds a lot like what I want to do. The problem is
      passing the variables as if they were form data to the perl script.
      Any thoughts? Or am I dead in the water?

      Thanks for the help!

      Shane

      Comment

      • John Bokma

        #4
        Re: Passing data from PHP to Perl?

        wrote:
        [color=blue]
        > I could code it in perl, but PHPis soooo easy to manipulate anything
        > from a database,[/color]

        *ROTFLMAO*

        since when? And since when is that hard in Perl?
        [color=blue]
        > and I want to create many interfaces to this perl
        > program in the future, so if this is possible, I could potentially save
        > myself a lot of time working with PHP.
        >
        > Now when you say "Have the PHP program redirect you to the perl
        > program", that sounds a lot like what I want to do. The problem is
        > passing the variables as if they were form data to the perl script.
        > Any thoughts? Or am I dead in the water?[/color]

        redirect to http://example.invalid/cgi-bin/yours...1=value1&name2
        =value2&etc.

        But note that if the images also need to be dynamically generated that you
        need more weird redirecting.

        Please read the documentation of CGI.pm, DBI etc. and save yourself a lot
        of troubles.

        --
        John MexIT: http://johnbokma.com/mexit/
        personal page: http://johnbokma.com/
        Experienced programmer available: http://castleamber.com/
        Happy Customers: http://castleamber.com/testimonials.html

        Comment

        • google_nospam@zaft.com

          #5
          Re: Passing data from PHP to Perl?


          John Bokma wrote:[color=blue]
          > wrote:
          >[color=green]
          > > I could code it in perl, but PHPis soooo easy to manipulate[/color][/color]
          anything[color=blue][color=green]
          > > from a database,[/color]
          >
          > *ROTFLMAO*
          >[/color]

          Okay, so I'm just too lazy to dust off my perl books ;-)
          [color=blue]
          > redirect to[/color]
          http://example.invalid/cgi-bin/yours...1=value1&name2[color=blue]
          > =value2&etc.
          >[/color]

          Yeah, but you can't pass more than 2,038 characters that way, right?.
          We're talking about (potentially) a lot of data.

          I guess I'll just use perl and save the headaches. Thanks for the
          help.

          Shane

          Comment

          • JDS

            #6
            Re: Passing data from PHP to Perl?

            On Tue, 08 Mar 2005 17:44:20 -0800, google_nospam wrote:
            [color=blue]
            > I could code it in perl, but PHPis soooo easy to manipulate anything
            > from a database, and I want to create many interfaces to this perl
            > program in the future, so if this is possible, I could potentially save
            > myself a lot of time working with PHP.
            >
            > Now when you say "Have the PHP program redirect you to the perl
            > program", that sounds a lot like what I want to do. The problem is
            > passing the variables as if they were form data to the perl script.
            > Any thoughts? Or am I dead in the water?
            >
            > Thanks for the help!
            >
            > Shane[/color]

            Instead of HTTP redirects which will get complicated, try serializing the
            information somehow. Save it to a plaing text file in serialzed form. Use
            XML, WDDX, or something like that.




            I don't know what happened to WDDX exactly, but it looks dead. Even so,
            it can still be useful.

            As for XML, you're on your own. Good starting place:



            --
            JDS | jeffrey@example .invalid
            | http://www.newtnotes.com
            DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

            Comment

            • John Bokma

              #7
              Re: Passing data from PHP to Perl?

              wrote:
              [color=blue]
              > John Bokma wrote:[color=green]
              >> wrote:
              >>[color=darkred]
              >> > I could code it in perl, but PHPis soooo easy to manipulate[/color][/color]
              > anything[color=green][color=darkred]
              >> > from a database,[/color]
              >>
              >> *ROTFLMAO*[/color]
              >
              > Okay, so I'm just too lazy to dust off my perl books ;-)[/color]

              Dust off CPAN then.
              [color=blue][color=green]
              >> redirect to[/color]
              > http://example.invalid/cgi-bin/yours...1=value1&name2[color=green]
              >> =value2&etc.[/color]
              >
              > Yeah, but you can't pass more than 2,038 characters that way, right?.[/color]

              Depends on server afaik. I wouldn't rely on it.
              [color=blue]
              > We're talking about (potentially) a lot of data.[/color]

              Then certainly don't move it between PHP and Perl. You can POST it to Perl,
              and give the result back via PHP, but just don't do that.


              --
              John MexIT: http://johnbokma.com/mexit/
              personal page: http://johnbokma.com/
              Experienced programmer available: http://castleamber.com/
              Happy Customers: http://castleamber.com/testimonials.html

              Comment

              • John Bokma

                #8
                Re: Passing data from PHP to Perl?

                JDS wrote:
                [color=blue]
                > On Tue, 08 Mar 2005 17:44:20 -0800, google_nospam wrote:
                >[color=green]
                >> I could code it in perl, but PHPis soooo easy to manipulate anything
                >> from a database, and I want to create many interfaces to this perl
                >> program in the future, so if this is possible, I could potentially
                >> save myself a lot of time working with PHP.
                >>
                >> Now when you say "Have the PHP program redirect you to the perl
                >> program", that sounds a lot like what I want to do. The problem is
                >> passing the variables as if they were form data to the perl script.
                >> Any thoughts? Or am I dead in the water?
                >>
                >> Thanks for the help!
                >>
                >> Shane[/color]
                >
                > Instead of HTTP redirects which will get complicated, try serializing
                > the information somehow. Save it to a plaing text file in serialzed
                > form. Use XML, WDDX, or something like that.[/color]

                Ouch: file locking etc.
                [color=blue]
                > http://www.devshed.com/c/a/Perl/Using-Perl-With-WDDX
                > http://us4.php.net/wddx
                >
                > I don't know what happened to WDDX exactly, but it looks dead. Even
                > so, it can still be useful.
                >
                > As for XML, you're on your own. Good starting place:
                > http://us4.php.net/manual/en/ref.xml.php[/color]

                SOAP, XML-RPC?

                Perl does that quite easily. Guess PHP too.

                --
                John MexIT: http://johnbokma.com/mexit/
                personal page: http://johnbokma.com/
                Experienced programmer available: http://castleamber.com/
                Happy Customers: http://castleamber.com/testimonials.html

                Comment

                • JDS

                  #9
                  Re: Passing data from PHP to Perl?

                  On Fri, 11 Mar 2005 03:36:51 +0000, John Bokma wrote:
                  [color=blue]
                  > Depends on server afaik. I wouldn't rely on it.[/color]

                  Depends on browser, actually. At least the 2038 charcter number

                  --
                  JDS | jeffrey@go.away .com
                  | http://www.newtnotes.com
                  DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

                  Comment

                  • John Bokma

                    #10
                    Re: Passing data from PHP to Perl?

                    JDS wrote:
                    [color=blue]
                    > On Fri, 11 Mar 2005 03:36:51 +0000, John Bokma wrote:
                    >[color=green]
                    >> Depends on server afaik. I wouldn't rely on it.[/color]
                    >
                    > Depends on browser, actually. At least the 2038 charcter number[/color]

                    I am sure every server has a limit, could be it's higher than 2038
                    (technically it can also be trimmed down by the OS, since it's passed in an
                    environment variable).

                    But the most important thing: don't do it.

                    --
                    John MexIT: http://johnbokma.com/mexit/
                    personal page: http://johnbokma.com/
                    Experienced programmer available: http://castleamber.com/
                    Happy Customers: http://castleamber.com/testimonials.html

                    Comment

                    Working...