magpie

RSS Feeds and image extraction indepth

删除回忆录丶 提交于 2019-12-25 02:25:44
问题 I have spent time trying to solve this problem and this is as far as ive got. basically im trying to pull images from rss feeds. i use magpie to process the feeds as shown below.. this snippet is within a class function getImagesUrl($str) { $a = array(); $pos = 0; $topos; $init = 1; while($init) { $pos = strpos($str, "img", $pos); if($pos != FALSE) { $topos = strpos($str, ">", $pos); $imagetag = substr($str, $pos, ($topos - $pos)); $url = $this->getImageUrl($imagetag); $pos = $topos; array

Using PHP to display RSS feed attributes

老子叫甜甜 提交于 2019-12-12 05:11:06
问题 I am attempting to display results from an RSS feed using PHP. I have successfully used magpie [magpierss.sourceforge.net] and rss_php [rssphp.net] However, both parsers I am having issues getting the attrbute values specifically media:thumbnail <media:content url="http://cache.wdcdn.net/cdn/asset/view/client/sfi/package/library/id/692313/format/o/h/5c5b86ff5dc804b2d314b3a9718bdef0/JelloAdultContentDirsCut.m4v

How to get <img> src from CDATA in RSS?

烂漫一生 提交于 2019-12-01 01:40:35
I am fetching data from RSS feed with Magpie. $rss[description] contains CDATA with html elements: <![CDATA[ <div> <a href='url'> <img src='img_url' alt='aaa' title='bbb' border='0' width='116' height='116'> </a> </div>]]> Some other text How can I fetch " img_url " from this? Is preg_match() the only way? Maybe I can use simpleXML? Tadeck CDATA you have is a string containing HTML. So first treat it as text, but since this text is meant to contain HTML, parse this text using solution appropriate for parsing HTML. In other words: use appropriate tool (HTML parser) for the job (parsing HTML) .

How to get <img> src from CDATA in RSS?

孤街浪徒 提交于 2019-11-30 20:49:06
问题 I am fetching data from RSS feed with Magpie. $rss[description] contains CDATA with html elements: <![CDATA[ <div> <a href='url'> <img src='img_url' alt='aaa' title='bbb' border='0' width='116' height='116'> </a> </div>]]> Some other text How can I fetch " img_url " from this? Is preg_match() the only way? Maybe I can use simpleXML? 回答1: CDATA you have is a string containing HTML. So first treat it as text, but since this text is meant to contain HTML, parse this text using solution