Jump to content

help using php to grab info for a blog?


rickyboy1982

Recommended Posts

I just read a post in the javascript forum asking wether it was rss or a blog used to add news and images to a site.he was directed here but i cant find anything here helpfull.Ok at the moment ive got rss feeds shown on a page that shows the news link and the story in brief.But really I want images to go with it, somebody else suggested that a blog would be the best option but was unable to provide any solid answers as to how to go about it.Is it possible with php to grab a story and the image that goes with it legit?

Link to comment
Share on other sites

It's possible to get content from other sites and do whatever you want with it. You can look for img tags on the page to find image URLs (presumably there's some sort of way you can tell from the HTML markup which image belongs with the story and which are interface elements or ads). Some news sites may also have RSS feeds which include the image URL as part of the feed. As to whether or not it's legal to show the content on your site, that's entirely dependent on what the content is, where you got it from, and how you're using it.

Link to comment
Share on other sites

Well what do you think the chances of a non-profit fan driven sites chances are of getting for example the bbc to allow me top use images as long as they are credited in full to the bbc?hmmm just noticed that sky sports rss feeds have an image with the feed bu its class as an attachment.anyway to grab this attachment also and show it?this is the code im using to grab rss

$xmldoc = new DOMDocument(); $xmldoc->load('http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/europe/rss.xml'); foreach ($xmldoc->getElementsByTagName('item') as $feeditem) { echo "<p><a href=\"" . $feeditem->getElementsByTagName('link')->item(0)->nodeValue . "\"target=_blank><b><br>"; echo $feeditem->getElementsByTagName('title')->item(0)->nodeValue . "</b></a><br>\n"; echo $feeditem->getElementsByTagName('description')->item(0)->nodeValue . "\n</p>"; }

Link to comment
Share on other sites

Well what do you think the chances of a non-profit fan driven sites chances are of getting for example the bbc to allow me top use images as long as they are credited in full to the bbc?
I wouldn't be the one to answer that question. Their policy might be written on their site.I see various <image> or <media> elements in the RSS feed, the URLs in those elements should be all you need to display the images.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...