0

I'd like to pull pictures and / or videos from another website onto my page, and i'd like to edit the looks with css. The website ofc. has rss, but i don't have an idea of how to do this. Someone told be before that i could ping the website and if there is new content, it automatically displays it on my site. How can this be done?

Thanks!

trisztann
  • 59
  • 1
  • 8
  • This might help you get started: http://stackoverflow.com/questions/250679/best-way-to-parse-rss-atom-feeds-with-php – Peon Jul 04 '12 at 12:08

2 Answers2

2

I am not quite sure if this is directly possible as it could theoretically cause a lot of traffic for the third-party website. Maybe you can read the content in your RSS-Reader and use this to update your site indirectly.

After all, aren't we talking about stealing content?

Devjosh
  • 6,450
  • 4
  • 39
  • 61
Wottensprels
  • 3,307
  • 2
  • 29
  • 38
  • "aren't we talking about stealing content?" Yes, you do… – feeela Jul 04 '12 at 12:12
  • It would be Stealing, if i were to 'copy' the content of that site to my server. The content wouldn't be stolen, since it's their images, only appearing on my website. If the user clicks it (or double clicks it) it would redirect them to the original website. Also this would make lots of traffic to the site - from which the content is 'linked' - making it go up in value. – trisztann Jul 04 '12 at 12:18
  • This is like saying that when i take photos of all work inside an art gallery, then show it outside (and maybe get a dollar or two by ads, hm?) it could grow the gallery by making their work known. What you are trying to do sounds to me like you wish to earn money by placing ads on content made by other ones. No offensive, just my opinion. – Wottensprels Jul 04 '12 at 12:20
  • This method is used by newssites that take content from other newssites who share. – C.A. Vuyk Jul 05 '12 at 06:22
1

As the Rss feed is XML, the best way to do this is with Ajax, here is a sample

window.onload = initAll;
var xhr = false;
var dataArray = new Array();
var url = "otherSites.xml";

function initAll() {

if (window.XMLHttpRequest) {
    xhr = new XMLHttpRequest();
}
else {
    if (window.ActiveXObject) {
        try {
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e) { }
    }
}

if (xhr) {
    xhr.onreadystatechange = setDataArray;
    xhr.open("GET", url, true);
    xhr.send(null);
}
else {
    alert("couldn't create XMLHttpRequest");
}
}

function setDataArray() {
var tag1 = "subject1";
var tag2 = "subject2";

if (xhr.readyState == 4) {
    if (xhr.status == 200) {
        if (xhr.responseXML) {

            var allData = xhr.responseXML.getElementsByTagName(tag1);
            for (var i=0; i<allData.length; i++) {
                dataArray[i] = allData[i].getElementsByTagName(tag2)[0].firstChild.nodeValue;
            }
        }
    }
    else {
        alert("the request failed" + xhr.status);
    }
}
}
C.A. Vuyk
  • 1,055
  • 17
  • 36
  • What should i Write in tag1 and tag2? – trisztann Jul 04 '12 at 19:22
  • Tag1 and tag2 are the XML tags as they appear in the XML RSS file of the site you are trying to republish. So have a look in the XML file and see what the names of the tags are. This method is used by newssites that take content from other newssites who share. It is just an example, you have to make a custom script yourself. Good luck! – C.A. Vuyk Jul 05 '12 at 06:19