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!!
Printable View
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!!
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.
ooo... ouch.
I guess I dont know howto do that then.
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 |||||";
I guess that type code is not capable of SSL, and SSL is what I need. So Im still lost
i just read LWP is capable of some kind of HTTPS SSL, so ill post that when I find it.
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";
}