lisovaccaro
lisovaccaro

Reputation: 33996

How to include a file from an HTTP address outside my server?

I just read a little tutorial on SSI and managed to show what I wantedbut I'd like to use an http path to point at this file so I can use it with sites in differente servers. How can I do it?

The path of the file I want to show is "http://chusmix.com/menubar/bar.html"

Thanks!

Upvotes: 0

Views: 145

Answers (2)

insaner
insaner

Reputation: 1705

If you really want to, you can write up a CGI script that simply calls wget or curl, on the desired url and include it via a virtual include call.

<!--#include virtual="/cgi-bin/url_getter.cgi?url=YOUR_URL" --> 

That's the safest bet. If you want to do something a little less secure, you can do it via a direct call to wget or curl via an exec include call.

<!--#exec cmd="wget YOUR_URL" --> 

Most hosting providers disable the exec call by default because it really isn't a good idea to use it. Don't use it, use a virtual call instead.

But to be honest, just including external pages like that is pretty unsafe, unless you happen to also control the page on the other server. Don't forget that the other page could contain javascript and hence do undesirable things to visitors of your page, who implicitly trust you, but maybe not the external source.

Upvotes: 1

anon
anon

Reputation: 4618

You cannot reference a URL with the #include SSI directive in either IIS or Apache.

The only way to "include" remote content is to use Javascript (possibly with Ajax) or a server-side HTTP request.

Upvotes: 0

Related Questions