|
-
Feb 10th, 2004, 06:59 PM
#1
Thread Starter
Frenzied Member
Perl Execute Perl Script
I want to run one perl script like this
Script.pl?one=one&two=two
from the first perl script..
I cant figure out a good way to do this.. I tried
system()
print qx|url|;
and
use URI;
my $url = URI->new('' );
Any ideas?
Thanks!!
-
Feb 11th, 2004, 05:08 AM
#2
To execute another CGI script, you can, for example, send a request to your web server, though I don't know how in Perl.
The problem with calling it directly is that you can't pass URL parameters the way you're used to, because these are parsed by the server and presented to your script in the way it expects. But you could do this parsing yourself, if you learn the way CGI works. The GET string (after the ? in the URL) is sent as command line parameter while the POST data is sent to stdin, so you'd have to open a pipe to the new process.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 11th, 2004, 10:12 AM
#3
Thread Starter
Frenzied Member
ooo... ouch.
I guess I dont know howto do that then.
-
Feb 11th, 2004, 11:36 AM
#4
Thread Starter
Frenzied Member
found a working way... try it.. its.. cool =-)
PHP Code:
use LWP::UserAgent;
# use HTTP::Request::Common qw(POST);
$ua = new LWP::UserAgent;
$ua->agent("Netscape 3.0");
$req = new HTTP::Request GET
=>"http://www.google.com/search?q=get+domain+perl&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8";
print "<h1>$url</h1>";
# Pass request to the user agent and get a response back
$res = $ua->request($req);
# Put the response into a page array
@page = $res->content;
print "<br> page = @page |||||";
-
Feb 11th, 2004, 11:42 AM
#5
Thread Starter
Frenzied Member
I guess that type code is not capable of SSL, and SSL is what I need. So Im still lost
-
Feb 11th, 2004, 01:01 PM
#6
Thread Starter
Frenzied Member
i just read LWP is capable of some kind of HTTPS SSL, so ill post that when I find it.
-
Feb 11th, 2004, 01:26 PM
#7
Thread Starter
Frenzied Member
Debian Install These:
sudo apt-get install libnet-ssleay-perl libcrypt-ssleay-perl libwww-perl
PHP Code:
my $uri = "https://www.mysite.com/";
#require CGI::Test::Input::URL;
#my $input = CGI::Test::Input::URL->new("$url");
#use LWP::UserAgent;
#my $response = LWP::UserAgent->new->get("/usr/share/XIII/update-default-sql-ledger.pl?masternum=$masternum&trans_id=$paymentno&transtype=0");
#print "/usr/share/XIII/update-default-sql-ledger.pl?masternum=$masternum&trans_id=$paymentno&transtype=0";
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $uri);
my $res = $ua->request($req);
if ($res->is_success) {
print $res->as_string;
} else {
print "Failed to GET '$uri': ", $res->status_line, "\n";
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|