FAQ
I want to run a cgi script from another server inside a local cgi page

SSI will only do local files, not remote URLs.



How can I do this?



Tony Heal

Pace Systems Group, Inc.

800-624-5999

theal@pace2020.com

Search Discussions

  • Jeff Pang at Aug 22, 2007 at 4:02 am

    -----Original Message-----
    From: Tony Heal <theal@pace2020.com>
    Sent: Aug 22, 2007 11:37 AM
    To: beginners@perl.org
    Subject: CGI Help

    I want to run a cgi script from another server inside a local cgi page

    SSI will only do local files, not remote URLs.



    How can I do this?

    How about using a iframe?

    --
    Jeff Pang - pangj@earthlink.net
    http://home.arcor.de/jeffpang/
  • Gunnar Hjalmarsson at Aug 22, 2007 at 6:45 am

    Tony Heal wrote:
    I want to run a cgi script from another server inside a local cgi page
    A quick and dirty example:

    #!/usr/bin/perl -T
    use strict;
    use warnings;
    use LWP::Simple;

    my ($content, $style) = getpage();

    print <<HTML;
    Content-type: text/html; charset=ISO-8859-1

    <html>
    <head>$style</head>
    <body style="margin-top: 5em; background: black">
    <table align="center" style="border: 3em solid red"><tr><td>
    $content
    </td></tr></table>
    </body></html>
    HTML

    sub getpage {
    my $domain = 'http://pace2020.com';
    my $html = get $domain;
    my ($style) = $html =~ /(<LINK.+?>)/;
    $style =~ s/\Q../$domain/;
    for ( $html ) {
    s/<!DOCTYPE.+<body>//s;
    s/<div style="width:760px.+<\/html>//s;
    }
    ( $html, $style )
    }

    __END__

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
  • Usenet at Aug 23, 2007 at 6:36 am

    On Aug 21, 8:37 pm, th...@pace2020.com (Tony Heal) wrote:
    I want to run a cgi script from another server inside a local cgi page
    You could use LWP or (better yet) WWW::Mechanize within your local CGI
    to fetch the content of the remote page and then display it from your
    local CGI script.


    --
    The best way to get a good answer is to ask a good question.
    David Filmer (http://DavidFilmer.com)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedAug 22, '07 at 3:37a
activeAug 23, '07 at 6:36a
posts4
users4
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase