Membership is FREE, giving all registered users unlimited access to every DNForum feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

included content across domains

Status
Not open for further replies.

Jack Gordon

Serial Entrepreneur
Legacy Exclusive Member
Joined
Nov 6, 2002
Messages
2,404
Reaction score
214
Is this possible, without resorting to frames?

For instance, I have some content at abc.com that I want to show up on a page at xyz.com. Short of copying and pasting it over every time it changes, is there a relatively easy html solution for me?

I know how to do this from page to page within a site, but my system doesn't seem to work with absolute urls.
 

Jeanco

Level 5
Legacy Platinum Member
Joined
Mar 8, 2004
Messages
265
Reaction score
0
You can use PHP for this. Just save the content from xyz in a file. ie: somefile.php

Then you can use an include statement to include the content. For example, here's something you could use to mimic xyz.com on as many paegs as you wish. This way whenever you change 'somefile.php' on the xyz site, it will change on all sites:

PHP:
<html>
<head>
<title>Whatever</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<?php include ('http://www.xyz.com/somefile.php') ?>

</body>
</html>
 

Anthony Ng

@Nameslave
Legacy Exclusive Member
Joined
May 22, 2002
Messages
4,567
Reaction score
14
PHP:
<?php include ('http://www.xyz.com/somefile.php') ?>
EXACTLY! PHP Includes are much more powerful than SSI (Server Side Includes), which require files to be on the same server. And I hate that long and ugly .shtml extension. :D
 

David G

Internet Entrepreneur
Legacy Exclusive Member
Joined
Apr 15, 2002
Messages
5,755
Reaction score
63
Do both the content site and the site using the same content need to be configured on the server to do PHP, or only one of the sites?

Sorry that my knowledge of php is poor. Wish I knew more about it. Any ideas on how I could at least learn the basics, written very simply from the viewpoint of a non-geek? Thanks.

<html>
<head>
<title>Whatever</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<?php include ('http://www.xyz.com/somefile.php') ?>

</body>
</html>
 

Anthony Ng

@Nameslave
Legacy Exclusive Member
Joined
May 22, 2002
Messages
4,567
Reaction score
14
Not really. The best thing about PHP includes is that you can include something off-server. (That's why you can use an "absolute" URL.) You can even include a text file.

As for learning PHP, you may check out php.net; but to be frank, if it is just for Includes, the line I quoted above is all you need (and powerful enough). ;)
 

David G

Internet Entrepreneur
Legacy Exclusive Member
Joined
Apr 15, 2002
Messages
5,755
Reaction score
63
Thanks Nameslave, you are an excellent Mod and you and Jeanco are very helpful.
 

Jack Gordon

Serial Entrepreneur
Legacy Exclusive Member
Joined
Nov 6, 2002
Messages
2,404
Reaction score
214
wow thanks everyone! I will take a crack at this when I have a spare moment (those are few and far between!) and I'll let you know how it goes.
 

Anthony Ng

@Nameslave
Legacy Exclusive Member
Joined
May 22, 2002
Messages
4,567
Reaction score
14
Hey, don't even mention it. :shy: :D

By the way, make sure you name your "holder" file .php (e.g. index.php) instead of .htm or .html. And some servers are configured to look for index.html and index.htm first as default, so you may need to rename those files (if any) as well.
 

Steen

Level 9
Legacy Platinum Member
Joined
Mar 24, 2003
Messages
4,853
Reaction score
1
nameslave said:
Not really. The best thing about PHP includes is that you can include something off-server. (That's why you can use an "absolute" URL.) You can even include a text file.



I thought some hosts/admins don't allow remote PHP Includes like above. Due to insecurities?
 

Jeanco

Level 5
Legacy Platinum Member
Joined
Mar 8, 2004
Messages
265
Reaction score
0
yeah, you can use an if statement that reads from a file on xyz.com. Something like xyz.com/allowed.txt

allowed .txt could contain the URLs that are allowed to be accessed through includes. Then whenever you add a new domain you just need to add it to the access list.
 

lgolding

Level 3
Legacy Platinum Member
Joined
Jan 25, 2003
Messages
73
Reaction score
0
The most effective use of this, some say decitful, is to store the includes data and extract any specific target bit of the site or text, like articles or headlines. Usually done by knowing the html layout of the source html and matching on a div name or simple html tag set of info, or named table, anything specific. dump the rest of the data and pring the results and essentially you have stolen a website or page infinately updated by others, that fits right into your webpage instead of replacing it.

This is why most hosts disable this php feature. Some don't!

Takes a long time for the source site to figure out they are being sapped.

Legit uses would be exactly what the this poster wants to do, share his own stuff across sites. Hard to convince a host of that legit use.

Regards,

L Golding
 

MediaHound

Former DNF Admin
Legacy Exclusive Member
Joined
Feb 25, 2004
Messages
4,162
Reaction score
7
Movie, is your sitedomain all php pages so far, or html, htm etc.
Because if so, you might want to do different things

AddHandler server-parsed .htm .html - this goes in .htaccess - turnes those types of pages into ssi enabled so you could use this tag <!--#include file="execute.php" --> and in execute.php you have the content

Lots more we can go from here with it, but this is a start. as you can see everyone here knows a lot about it, different ways of doing it, and would help

Maybe someone would give me a few ideas -
http://www.dnforum.com/showthread.php?p=378100
 

loho27

Level 4
Legacy Platinum Member
Joined
Mar 11, 2004
Messages
200
Reaction score
0
Just as a matter of interest smartcgis.com have got a free script called the executer which acheives much the same thing.

you just drop the file in the cgi-bin, point it to the URL you would like to grab, and on the page where you want it displayed, pont to the executer.cgi file
It is just an alterative,
 

HeavyLifting

Level 7
Legacy Platinum Member
Joined
Jan 21, 2003
Messages
850
Reaction score
1
MovieDomains said:
Is this possible, without resorting to frames?

For instance, I have some content at abc.com that I want to show up on a page at xyz.com. Short of copying and pasting it over every time it changes, is there a relatively easy html solution for me?

I know how to do this from page to page within a site, but my system doesn't seem to work with absolute urls.

i use php/mysql for my domains. all of them point to my server ip and my default index page reads in the domain name (via environental vars) and then queries a database for content, hit counting, and other stuff. really powerful and pretty easy. i don't know what i'd do with it.
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 6) View details

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members Online

Premium Members

Upcoming events

Latest Listings

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators

Top Bottom