Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 9th, 2001, 02:03 AM
AzteK AzteK is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 AzteK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation

how can I get an output of lets say a php script and display it using perl?

thanks

AzteK

Reply With Quote
  #2  
Old February 9th, 2001, 02:18 AM
AzteK AzteK is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 AzteK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I forgot to mention that then I would display that results using ssi to display the results of the cgi

Reply With Quote
  #3  
Old February 9th, 2001, 05:35 AM
Matt M Matt M is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 2 Matt M User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry?
I don't know about anybody else but I'm confused.
What are you trying to achieve?

Reply With Quote
  #4  
Old February 9th, 2001, 10:40 AM
AzteK AzteK is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 AzteK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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]

Reply With Quote
  #5  
Old February 9th, 2001, 03:28 PM
AzteK AzteK is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 AzteK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy :-0

Please let me know if I am still unclear.

Reply With Quote
  #6  
Old February 9th, 2001, 05:01 PM
dwarf dwarf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 300 dwarf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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]

Reply With Quote
  #7  
Old February 9th, 2001, 05:54 PM
AzteK AzteK is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 AzteK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #8  
Old February 10th, 2001, 01:18 AM
dwarf dwarf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 300 dwarf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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??

Reply With Quote
  #9  
Old February 11th, 2001, 01:32 PM
AzteK AzteK is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 AzteK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > getting an output and displaying in perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT