how to include something from ANOTHER site...

They have: 34 posts

Joined: Feb 2002

OK, I've noticed that in PHP, I can include something that's under a different domain... but whenever I've tried that in an shtml page, it doesn't work...

on my site... let's say Site A... I use this command... and I can access / run the script... which is a banner script

whereas on site b, when I use PHP, I can use this syntax to refer to that script:

<?php
include "http://www.SiteA.com/cgi-bin/WWWAdvertsSSI.cgi" ;
?>

unfortunately, the page I want to use to refer to SiteA is in html, and hence I can't run the php line... and doesn't work either...

any ideas?

Thanks in advance

He has: 1,016 posts

Joined: May 2002

php.net/fopen

You'll need some PHP programming done if you just want to include parts of another website.

They have: 34 posts

Joined: Feb 2002

Is there anyway I can call this script with HTML only in an .shtml page?

If at all possible, I don't want to convert all my pages to php

He has: 1,016 posts

Joined: May 2002

You need to call it from a .php file unless you configure Apache to parse .html files as PHP.

dk01's picture

He has: 516 posts

Joined: Mar 2002

Can you use the shtml execute command? I dunno I have never actually used it.
-dk

mjames's picture

They have: 2,064 posts

Joined: Dec 1999

Quote: Originally posted by dk01
Can you use the shtml execute command? I dunno I have never actually used it.
-dk

No, you cannot. SSI only works when you are calling files from your servers. You could use a JavaScript include, possibly, but the other site would have to do that for you and I don't recommend it because people with it disable won't see it and it's slower.

He has: 1,016 posts

Joined: May 2002

Actually, you can execute files/scripts with SSI exec command.

They have: 447 posts

Joined: Oct 1999

you can't include anything that is not on your server, or a mapped server, OTHER THAN what you'd see in a browser.

IE: you CAN indeed include a PHP file from a different domain if URL fopen wrappers are enabled, or you enable them, BUT you're not including it as PHP code, you're going to get the HTML output of the script (the same thing you'd see if you visited the URL in a browser). Now if the script outputs valid php code, or the webserver isnt configured to parse PHP files, PHP will fetch the code and execute it.

It's just the way it is, and the way it should be, and there's NO way around it, and it should be fairly obvious why that is. Being able to arbitrarily access anyones working code whenever you want just isn't a feature of PHP or any other language.

dk01's picture

He has: 516 posts

Joined: Mar 2002

I think he is just trying to get the output rob. Not the actual code. Correct me if I am wrong but couldn't you have one php file on your local site that could access the remote site's output and then just use the execute command in SSI to run the php page. This would be slow but I think it would work. Something like:

I am not sure whether you would use "include" or "exec" for that last one but then you could have have getremotesite.php be:

<?php
include($url);
?>

Just a thought.
-dk

They have: 34 posts

Joined: Feb 2002

Much thanks for all the input guys...

I crapped out and just installed the script on both servers so i don't have to include a script remotely =)

Thank you so much for the info tho!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.