472,143 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

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

Jul 17 '05 #1
9 2665
wrote:
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.
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).
I really want to avoid any intermediate pages if possible.


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
Jul 17 '05 #2
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

Jul 17 '05 #3
wrote:
I could code it in perl, but PHPis soooo easy to manipulate anything
from a database,
*ROTFLMAO*

since when? And since when is that hard in Perl?
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?


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
Jul 17 '05 #4

John Bokma wrote:
wrote:
I could code it in perl, but PHPis soooo easy to manipulate anything from a database,
*ROTFLMAO*


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


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

Jul 17 '05 #5
JDS
On Tue, 08 Mar 2005 17:44:20 -0800, google_nospam wrote:
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


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.

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
--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Jul 17 '05 #6
wrote:
John Bokma wrote:
wrote:
> I could code it in perl, but PHPis soooo easy to manipulate anything > from a database,
*ROTFLMAO*


Okay, so I'm just too lazy to dust off my perl books ;-)


Dust off CPAN then.
redirect to

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


Yeah, but you can't pass more than 2,038 characters that way, right?.


Depends on server afaik. I wouldn't rely on it.
We're talking about (potentially) a lot of data.


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
Jul 17 '05 #7
JDS wrote:
On Tue, 08 Mar 2005 17:44:20 -0800, google_nospam wrote:
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
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.


Ouch: file locking etc.
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


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
Jul 17 '05 #8
JDS
On Fri, 11 Mar 2005 03:36:51 +0000, John Bokma wrote:
Depends on server afaik. I wouldn't rely on it.


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

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

Jul 17 '05 #9
JDS wrote:
On Fri, 11 Mar 2005 03:36:51 +0000, John Bokma wrote:
Depends on server afaik. I wouldn't rely on it.


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


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
Jul 17 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Romuald Favre | last post: by
2 posts views Thread by Matthew | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.