You are here: Re: Grab img tag from Google Web album's RSS item description « All PHP « IT news, forums, messages
Re: Grab img tag from Google Web album's RSS item description

Posted by Koncept on 01/17/07 02:09

In article <1168965554.371518.28080@a75g2000cwd.googlegroups.com>,
Chris Matchett <news.chris@gmail.com> wrote:

> How can I remove everything but the img tag, and it's attributes, from
> the html generated by Google Web Album's RSS item description shown
> below?
>
> I have the code I am using at present below but I was hoping for a more
> reliable alternative.


The regular expression I am using here is VERY basic, but it's another
alternative:


<?php
$html = file_get_contents( "http://www.ebay.com" );
preg_match_all("/<img[^>]+>/", $html, $matches );
foreach( $matches[0] as $match ){
if(preg_match( '/src="([^"]+)"/', $match, $src, PREG_OFFSET_CAPTURE
)){
echo "Got source image : ", $src[1][0], "\n";
}
}
?>

--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация