Solved

SSI linking different servers

Posted on 2001-08-17
7
174 Views
Last Modified: 2013-12-25
I'm just learning SSI. Please forgive my ignorance.
I?m using the file option to build up a web page: <!--#include file="/includes/XXX.html"--> on an Apache server.

And I?ve discovered you can only have includes in the www root directory and the includes directory.

Apache configures it in:
<Directory /var/www/includes>
        Options Includes
</Directory>

Though I haven?t changed it yet, I guess this option can allow me to add or change the includes directory.

I want to write a page built up on #include file data from several different servers to report on sites I manage so I can have some shtml like this:

<!--#include file="http://www.site1.com/includes/XXX.html"-->
<!--#include file=" http://www.site2.net/includes/XXX.html"-->
<!--#include file=" http://www.site3.org/includes/XXX.html"-->

How do I configure my shtml and/or Apache to allow this?

And if the answer to my question, is ?you can?t do this? please don?t bother replying!

Thank you for your time and help.

Stoke
0
Comment
Question by:Stoke
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6397914
<!--#include virtual="/cgi-bin/include.cgi?url=www.site1.com/includes/XXX.html" -->
<!--#include virtual="/cgi-bin/include.cgi?url=www.site2.com/includes/XXX.html" -->

where include.cgi simply gets the required file passed in as value of the url parameter.

or, if you have wget for example:

  <!--#exec cmd="wget http://www.site1.com/includes/XXX.html" -->
0
 

Author Comment

by:Stoke
ID: 6405474
Dear Ahoffmann,

This looks like an excellent solution. Would you send me the include.cgi script please?

Thank you,

Stoke
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6405572
use LWP;
USE LWP::UserAgent;
use URI;
use HTTP::Request;
use CGI;
$::q=new CGI;
$::url=q->param('url');
$n=new HTTP::Request(GET=>"$url");
$u=LWP::UserAgent->new(agent=>"is this nice"); $x=$u->request($n);
print $x->content;
# to be improved ;-)
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Stoke
ID: 6405627
Hi,

I put the script on and got:
The server encountered an internal error or misconfiguration and was unable to complete your request.

I checked the error log on it came up with:

Premature end of script headers

Please do you know what I need to do to fix it?
0
 

Author Comment

by:Stoke
ID: 6406668
I managed to create a perl script to redirect to another website, but the problem it created is that it took the entire page to the new web site. I want to be able to build up a page based on information from other websites.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 6406990
> Premature end of script headers
I missed
    print $::q->header;
'cause I thought you use this script multiple to build a single page.

>  want to be able to build up a page based on information
from other websites.
You only can get complete pages, not just parts it. You must filter what you need yourself.
0
 

Author Comment

by:Stoke
ID: 6408920
I think you've helped me enough to build up the pages I need. Thank you.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question