You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Chris Schults <cs...@grist.org> on 2006/10/19 23:49:22 UTC

[QUESTION] How to include content from another site (on the same server)?

Hello all. First post from a mod_perl newbie ...

I have a website (www.example.org) and a blog (blog.example.org), which are
both hosted on the same server and I believe are running under the same
instance of Apache (1.3.37). The OS is freeBSD 4.9.

Specifically, on the website, I have a static HTML file where I need to
include content from the blog, which is dynamically generated. Normally for
including content, I use a virtual include, but since the content is from a
different site, I'm under the impression this method won't work. Thus, I've
tried this:

<!--#perl sub="sub {
use LWP::Simple 'get';
}"-->
<!--#perl sub="sub {
my $content = get( 'http://blog.example.org/include_file' ) or die $!;
print $content;
}"-->

While this works, I'm told this is probably one of the most "expensive" ways
to accomplish this. Is this true? Can anyone recommend another method?

Also, would it be possible to setup www.example.org/blog/ in a way where a
virtual include would work?

Thanks in advance,

Chris

--------------------------

Chris Schults
Web Production Manager
Grist Magazine
710 Second Avenue, Suite 860
Seattle, WA  98104
Phone: 206-876-2020, ext. 204
Fax: 253-423-6487
<http://www.grist.org>

To sign up for Grist by email, the world's top environmental news served up
with a sense of humor, click here:
<http://www.grist.org/signup/>


Re: [QUESTION] How to include content from another site (on the same server)?

Posted by Jonathan <mo...@2xlp.com>.
off the top of my head..

a-
	use an ssi or include to the file,  but just use an absolute path,  
or create a synlink so it falls into an easily readable section.  if  
its on the same machine, unless apache is jailed, there's a way to  
get to your data.

b- 	
	query the blog's cms store directly

c- 	
	be lazy- just do an iframe to host what you want off the blog



Re: [QUESTION] How to include content from another site (on the same server)?

Posted by Mark Maunder <mm...@gmail.com>.
Come to think of it, you'll want to combine mod_rewrite and mod_proxy
- I think there's an example of how to do this on the mod_rewrite
docs.

On 10/19/06, Mark Maunder <mm...@gmail.com> wrote:
> Chris,
>
> I've done something like this with mod_proxy. You can map url's to
> external hosts and mod_proxy fetches the content and serves it back to
> the user from your machine. It's a module written in C so it'll be a
> lot faster than LWP.
>
> Regards,
>
> Mark.
>
> On 10/19/06, Chris Schults <cs...@grist.org> wrote:
> > Hello all. First post from a mod_perl newbie ...
> >
> > I have a website (www.example.org) and a blog (blog.example.org), which are
> > both hosted on the same server and I believe are running under the same
> > instance of Apache (1.3.37). The OS is freeBSD 4.9.
> >
> > Specifically, on the website, I have a static HTML file where I need to
> > include content from the blog, which is dynamically generated. Normally for
> > including content, I use a virtual include, but since the content is from a
> > different site, I'm under the impression this method won't work. Thus, I've
> > tried this:
> >
> > <!--#perl sub="sub {
> > use LWP::Simple 'get';
> > }"-->
> > <!--#perl sub="sub {
> > my $content = get( 'http://blog.example.org/include_file' ) or die $!;
> > print $content;
> > }"-->
> >
> > While this works, I'm told this is probably one of the most "expensive" ways
> > to accomplish this. Is this true? Can anyone recommend another method?
> >
> > Also, would it be possible to setup www.example.org/blog/ in a way where a
> > virtual include would work?
> >
> > Thanks in advance,
> >
> > Chris
> >
> > --------------------------
> >
> > Chris Schults
> > Web Production Manager
> > Grist Magazine
> > 710 Second Avenue, Suite 860
> > Seattle, WA  98104
> > Phone: 206-876-2020, ext. 204
> > Fax: 253-423-6487
> > <http://www.grist.org>
> >
> > To sign up for Grist by email, the world's top environmental news served up
> > with a sense of humor, click here:
> > <http://www.grist.org/signup/>
> >
> >
>
>
> --
> Mark Maunder <mm...@gmail.com>
> +1-206-6978723
>


-- 
Mark Maunder <mm...@gmail.com>
+1-206-6978723