Solved

SSI linking different servers

Posted on 2001-08-17
7
173 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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