in reply to Re: ssl details cgi script
in thread ssl details cgi script

It works for me using this html with www.google.com

<html> <head> </head> <body> <form action="cgi-bin/test/expire.pl" method="post"> <input type="text" name="sitename"/> <input type="submit"/> </form> </body> </html>
poj

Replies are listed 'Best First'.
Re^3: ssl details cgi script
by alokranjan (Acolyte) on Jul 26, 2015 at 04:27 UTC
    Is it also showing the expiry date? I used the similar HTML and tried the html suggested by you but still its only showing the website name not the expiry date.

    Thanks

      The problem appears when I use -T on the shebang but I can't explain why yet.
      Update : Untaiting fixes the problem. Try this
      #!/usr/bin/perl -wT use strict; use CGI ':standard'; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use Net::SSL::ExpireDate; use POSIX qw(strftime); print header; print start_html('SSL Expire Dates'); my $t_site = param('sitename'); # change to suit $t_site =~ s/^\s+|\s+$//; if ( $t_site =~ /[^A-Za-z0-9.-]/ ){ print pre("Sitename [$t_site] not valid"); } else { $t_site =~ /(.+)/; my $sitename = $1; print pre("Site : ".$sitename); my $ed = Net::SSL::ExpireDate->new( https => $sitename ); if (defined $ed->expire_date) { print pre("Expires : ".$ed->expire_date); } else { print pre("Expires : NOT DEFINED"); } } my $now = strftime "%Y-%m-%d %T", localtime; print pre("Time now : $now"); print end_html;
      poj