GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Best way to syndicate content between sites? (https://gfy.com/showthread.php?t=516896)

jawanda 09-15-2005 09:31 AM

Best way to syndicate content between sites?
 
Hey guys, easy straightforward question.

I need to be able to control a small amount of content on a 3rd party website, but they'd prefer not to give me full access to their servers ..

so what's the best way to syndicate this content? Virtual Include? Php? is there something easier that I'm not thinking of?

any advise greatly appreciate.

thanks,

-Phil

jawanda 09-15-2005 09:35 AM

Come on guys, i know someone here has a good solution for me! :thumbsup

-p

psili 09-15-2005 09:37 AM

What type of content and how is it formatted on the client end?

Can you just create an XML schema and let them pull it from your servers?

jawanda 09-15-2005 09:40 AM

Quote:

Originally Posted by psili
What type of content and how is it formatted on the client end?

Can you just create an XML schema and let them pull it from your servers?


Basically some text links and a few small pics that need to rotate weekly.

I need to look into xml, that sounds like a good option but I don't even know where to start with it.

Edit: On the client end it becomes part of the normal html-based page layout.

Any tips?

Thanks!

-Phil

jawanda 09-15-2005 09:45 AM

timmmmeh?

psili 09-15-2005 09:48 AM

The only reason I was thinking XML as pretty much any scripting language could grab it from a remote server and parse it however they want - much like how RSS is such a big hit since it's just XML.

Code:

<?xml version="1.0"?>
<content>
 <item>
  <link>http://somewhere.com</link>
  <text>text for the hyperlink</text>
  <img width="100" height="120">http://somewhere.com/img.jpg</img>
 </item>
 <item>
  <link>http://somewhere.com</link>
  <text>text for the hyperlink</text>
  <img width="100" height="120">http://somewhere.com/img.jpg</img>
 </item>
 <item>
  <link>http://somewhere.com</link>
  <text>text for the hyperlink</text>
  <img width="100" height="120">http://somewhere.com/img.jpg</img>
 </item>
 .......
</content>

Let's say you somehow dymanically create the above XML file. Any remote server can grab it when they want, parse it (using any number of parsers; i.e. tons of free PHP tutorials for parsing) into the HTML formatting they need.

Basically, if you remove the data from the presentation (html), the end user has free reign on how they can display it.

Then again, it takes added knowledge to be able to parse it in the first place.

FiReC 09-15-2005 10:07 AM

Quote:

Originally Posted by jawanda
Hey guys, easy straightforward question.

I need to be able to control a small amount of content on a 3rd party website, but they'd prefer not to give me full access to their servers ..

so what's the best way to syndicate this content? Virtual Include? Php? is there something easier that I'm not thinking of?

any advise greatly appreciate.

thanks,

-Phil

If you want full control of the look and feel of your section on the page, why not just do a remote include like you mentioned. Create an html page on your server and have them include it with <? include('http://www.yourserver.com/pageonyourserver.html'); ?>

jawanda 09-15-2005 10:09 AM

Quote:

Originally Posted by psili
The only reason I was thinking XML as pretty much any scripting language could grab it from a remote server and parse it however they want - much like how RSS is such a big hit since it's just XML.

Code:

<?xml version="1.0"?>
<content>
 <item>
  <link>http://somewhere.com</link>
  <text>text for the hyperlink</text>
  <img width="100" height="120">http://somewhere.com/img.jpg</img>
 </item>
 <item>
  <link>http://somewhere.com</link>
  <text>text for the hyperlink</text>
  <img width="100" height="120">http://somewhere.com/img.jpg</img>
 </item>
 <item>
  <link>http://somewhere.com</link>
  <text>text for the hyperlink</text>
  <img width="100" height="120">http://somewhere.com/img.jpg</img>
 </item>
 .......
</content>

Let's say you somehow dymanically create the above XML file. Any remote server can grab it when they want, parse it (using any number of parsers; i.e. tons of free PHP tutorials for parsing) into the HTML formatting they need.

Basically, if you remove the data from the presentation (html), the end user has free reign on how they can display it.

Then again, it takes added knowledge to be able to parse it in the first place.

Cool psilli thanks for the info!

At first i was just thinking of using a virtual include which i think would be easier, but i just read that virtual includes don't work cross-domain. anyone know if that's true? I gues i just need to try it lol ..

Thanks again !!

-Phil

DutchTeenCash 09-15-2005 10:10 AM

yeah in include maybe an iframe, so many options, you could treat it like a plugin

jawanda 09-15-2005 10:10 AM

Quote:

Originally Posted by FiReC
If you want full control of the look and feel of your section on the page, why not just do a remote include like you mentioned. Create an html page on your server and have them include it with <? include('http://www.yourserver.com/pageonyourserver.html'); ?>

Does the "client" webpage need to be .php in order for that to work?

Thanks,

-Phil

jawanda 09-15-2005 10:11 AM

Quote:

Originally Posted by thinkx
yeah in include maybe an iframe, so many options, you could treat it like a plugin


Ahh I forgot about iframes, that is another good option although id prefer to use a regular (non php) include if possible.

:thumbsup

Thanks!

-P

jawanda 09-15-2005 10:34 AM

Great info here guys, any other suggestions?

Thanks again,


-Phil

mrkris 09-15-2005 10:40 AM

i like rss:

require_once 'XML/RSS.php;
$rss =& new XML_RSS('http://some_domain_here/rss');
$rss->parse();
print_r($rss->getItems());

jawanda 09-15-2005 11:08 AM

Quote:

Originally Posted by mrkris
i like rss:

require_once 'XML/RSS.php;
$rss =& new XML_RSS('http://some_domain_here/rss');
$rss->parse();
print_r($rss->getItems());

Awesome! :thumbsup

I of course have some studying to do, but I can see what you're trying to show me here :)

-Phil

psili 09-15-2005 11:46 AM

I got bored and hacked a javascript solution together from some web tutorials. No need for PHP or anything.

"sample.xml" file that could be stored on a remote server:
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<content>
 <item>
  <link>http://www.yahoo.com/</link>
  <text>This links to yahoo.com</text>
  <image>http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif</image>
 </item>
 <item>
  <link>http://www.google.com</link>
  <text>Google is good.</text>
  <image>http://www.google.com/intl/en/images/logo.gif</image>
 </item>
</content>

And the following is an html page that will parse that XML file into HTML and place it where you want in an html page:

[html]
<html>
<head>
<title>XML Parser</title>
<script language="JavaScript">
var xmlhttp;
var output = "";
function loadXMLDoc(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("GET",url,true)
xmlhttp.send(null)
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp)
{
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("GET",url,true)
xmlhttp.send()
}
}
}


function xmlhttpChange()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyStatehahahaha4)
{
// if "OK"
if (xmlhttp.statushahahaha200)
{
xmlObj = xmlhttp.responseXML;
parseXML(xmlObj);
}
else
{
alert("Problem retrieving XML data")
}
}
}

function parseXML(xmlObj)
{
items = xmlObj.getElementsByTagName("item");
for(i=0;i<items.length;i++)
{
link = items[i].getElementsByTagName("link")[0].firstChild.nodeValue;
text = items[i].getElementsByTagName("text")[0].firstChild.nodeValue;
image = items[i].getElementsByTagName("image")[0].firstChild.nodeValue;
output += "<p><a href=\"" + link + "\">"
+ "<img src=\""+image+"\" align=left>"
+ text
+ "</a></p><hr/>";
}
document.getElementById("targetText").innerHTML = output;
}
</script>
</head>
<body onLoad="loadXMLDoc('sample.xml')">
<p>Output from xml document:</p>
<div id="targetText">
<!-- output goes here -->
</div>
</body>
[/html]

jawanda 09-15-2005 10:56 PM

holy crap psilli you are the BEST!!! Thank you so much!!! :thumbsup

Fuck yeah buddy :)

-P


All times are GMT -7. The time now is 11:15 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123