rss

Limit XML data when converting JSON to XML - PHP

女生的网名这么多〃 提交于 2019-12-11 04:39:09
问题 I am using this code to convert JSON to XML and everything is working fine. I am getting 200 records in the XML but i want to limit it to 50. I just want to create the XML file with latest 50 records. Instead of converting whatever we have in JSON to XML. function array_to_xml( $data, &$xml_data ) { foreach( $data as $key => $value ) { if( is_numeric($key) ){ $key = 'item'.$key; //dealing with <0/>..<n/> issues } if( is_array($value) ) { $subnode = $xml_data->addChild($key); array_to_xml(

php rss feed show images

蓝咒 提交于 2019-12-11 04:27:46
问题 I am trying to show the images in the following rss feed and would appreciate help from somebody please. I have tried getAttribute but am not sure how to format it or where in the code to put it, so I have taken it out to avoid confusion. The following code is working, but I need to add the code to display the images. <?php $rss = new DOMDocument(); $rss->load('http://xml.thinkspain.com/think-spain-feeds/spanish-news.xml'); $feed = array(); foreach ($rss->getElementsByTagName('item') as $node

How to create an RSS feed and display it?

安稳与你 提交于 2019-12-11 04:26:53
问题 On a website I am maintaining for a radio station they have a page that displays news articles. Right now the news is posted in an html page which is then read by a php page which includes all the navigation. I have been asked to make this into and RSS feed. How do I do this? I know how to make the XML file but the person who edits the news file is not technical and needs a WYSIWYG editor. Is there a WYSIWYG editor for XML? Once I have the feed how do I display it on my site? Im working with

simplexml_load_file() [function.simplexml-load-file]: Start tag expected, '<' not found in

99封情书 提交于 2019-12-11 04:17:22
问题 I am using simplexml_load_file to load the BBC Weather RSS feed and it randomly gives the following error: Warning: simplexml_load_file() [function.simplexml-load-file]: :1: parser error : Start tag expected, '<' not found in It seems to fail randomly. My code is not dynamically changing so I can't figure out why it fails only sometimes. If I grab the rss file that "supposedly" has the missing < tag and store it on my computer and point the simplexml_load_file to that location it works fine.

parse xml in an iframe

老子叫甜甜 提交于 2019-12-11 04:06:03
问题 I want to be able access an rss feed from js. I have the ability to configure both servers to use the same domain (but different subdomains - eg static.benanderson.us and tech.benanderson.us). I was hoping I could use the document.domain property to get around the xss issue. Here's a snippet http://static.benanderson.us/example.js (not actually live): document.domain = 'benanderson.us'; new Ajax.Request('http://tech.benanderson.us/feeds/posts/default', { \\error However, that doesn't work. I

Retrieving RSS posts older than those included in feed

走远了吗. 提交于 2019-12-11 03:59:31
问题 When creating an RSS reader, you download the XML formatted document pointed to by the RSS feed link, and you can parse it manually or using the functionality in the SyndicationFeed namespace. So if we take Scott Guthrie's blog as an example, you download the RSS feed document here, and parse it. My problem is that this document only holds 15 items, yet he has been blogging for a number of years. Is there a standard or established way of getting the older posts not included in the RSS feed

simple rss downloader in haskell

非 Y 不嫁゛ 提交于 2019-12-11 03:36:44
问题 Yesterday i tried to write a simple rss downloader in Haskell wtih hte help of the Network.HTTP and Feed libraries. I want to download the link from the rss item and name the downloaded file after the title of the item. Here is my short code: import Control.Monad import Control.Applicative import Network.HTTP import Text.Feed.Import import Text.Feed.Query import Text.Feed.Types import Data.Maybe import qualified Data.ByteString as B import Network.URI (parseURI, uriToString) getTitleAndUrl ::

scraping a non RSS page to generate a feed

 ̄綄美尐妖づ 提交于 2019-12-11 03:26:25
问题 I want to scrape a page that regularly updates (adding new articles with exactly the same structure as previous ones) in order to generate an RSS feed. I can write the code to analyse the page easily, but how do I emulate a ping i.e. when the page updates how can my php script know? Does it have to be a cron job? (Probably a duplicate question I know, but searched for a direct answer with no luck. Closest I got was Scrape and generate RSS feed, which has a scraping script but no info on how

Wordpress simplexml_load_file() parse error

风流意气都作罢 提交于 2019-12-11 03:13:53
问题 So i am having a killer issue. I can't get this xml data to show. It was working 3 months ago and now it's not. Any suggestions to fix this bugger would help me out a ton! Yes - I have checked to see if the link is working, and live and it is. <?php if(file_exists('http://blog.millcitychurch.org/blog/rss.xml')){ ?> <h1>// THE LATEST FROM MILL city</h1> <div class="feed"> <?php $xml = file_get_contents('http://blog.millcitychurch.org/blog/rss.xml'); $url = 'http://blog.millcitychurch.org/blog

Server Side Include - php

旧时模样 提交于 2019-12-11 03:05:47
问题 I'm updating a site that is currently static html (i.e. index.html). I'd like to pull in blog posts into the page and only know of SimplePie to accomplish this. Question 1 - If I update the site from .html to .php is there a hit in SEO while the Search Engines re-index? Question 2 - Is there a way to use Server Side Includes to include a .php file of my SimplePie results, or another way to pull blog posts directly into a .html file? I'd appreciate advice. 回答1: For question 1 - no, not