|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how can I get an output of lets say a php script and display it using perl?
thanks AzteK |
|
#2
|
|||
|
|||
|
I forgot to mention that then I would display that results using ssi to display the results of the cgi
|
|
#3
|
|||
|
|||
|
Sorry?
I don't know about anybody else but I'm confused. What are you trying to achieve? |
|
#4
|
|||
|
|||
|
OK I'm sorry for not being clear. This might sound useless to some but this is the solution to my project.
The basic idea is that I want to fetch the results of a php script using a perl script. So when executing the perl script it would display the results from the php script. Then I would display the results of perl script using ssi. ssi <- perl <- php Thanks, AzteK p.s. I don't know much about perl so a url of a code would help.. [Edited by AzteK on 02-09-2001 at 09:42 AM] |
|
#5
|
|||
|
|||
|
Please let me know if I am still unclear.
|
|
#6
|
|||
|
|||
|
Compile PHP as a CGI binary, and then run it with Perl's system() function. It should do the trick. Although, just FYI, the order is almost always the opposite. PHP calls Perl.
Another thing that just sprung into mind: if you already have PHP compiled as a Apache module, you don't need to recompile it (maybe). Try to open a socket from Perl (via the IO::Socket module, or Perl's internal Socket module or maybe you can use LWP::Simple) and use the simple GET command on your PHP script. Apache should GET the script and execute as if the browser asked for it. So you should be able to get the output to your Perl script. Of course, this is a pure hack, so use it at your own risk. (Performance-wise) [Edited by dwarf on 02-09-2001 at 04:27 PM] |
|
#7
|
|||
|
|||
|
LWP::Simple
would do the trick. IE, fetching a URL or just miroring. The things is, the cgi would be running on my server. I don't know how to code so a URL to a code would really help me... Thanks! |
|
#8
|
|||
|
|||
|
Well, there are numerous examples in the Perl distribution (for Sockets) as well as in LWP:
ocs. Go to CPAN and search for LWP::Simple, you have an option to search the documentation of all the modules, so do that.Basically, its similar to using filehandles. With LWP its even more simple. Something like: Code:
use LWP::Simple; $url = "http://www.someserver.com/somescript.php"; $script_insides = get($url); print $script_insides; If you do this in the shell, you would get a bunch of HTML code. But in a browser, you would get teh output of a PHP script, and thats what you want, right?? Just being curious: why use PHP?? Why not do everything from Perl?? |
|
#9
|
|||
|
|||
|
Thanks!
Yes that's correct. That's what I wanted
. I just don't have time to learn perl at this moment and even if I wanted to do this with perl I would still need to call the perl script from another server ![]() Thanks for your help! AzteK |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > getting an output and displaying in perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|