<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TecnoRetales &#187; Expresiones Regulares</title>
	<atom:link href="http://www.tecnoretales.com/tag/expresiones-regulares/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tecnoretales.com</link>
	<description>La experiencia no se olvida</description>
	<lastBuildDate>Wed, 07 Jul 2010 21:23:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- google ad injected by adsense-optimizer http://www.adsenseoptimizer.de -->
			<div  style="padding:7px; float: right; padding-right: 0; margin: 3px;"><!-- Ad number: 1 --><script type="text/javascript"><!--
    	 
    	google_ad_client = "pub-7180773421652966"; google_alternate_color = "FFFFFF";
		google_ad_width = 468; google_ad_height = 60;
		google_ad_format = "468x60_as"; google_ad_type = "text";
		google_ad_channel =""; google_color_border = "FE8B00";
		google_color_link = "FE8B00"; google_color_bg = "FFFFFF";
		google_color_text = "000000"; google_color_url = "D9D9D9";
		google_ui_features = "rc:6"; //--></script>
		<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>	<item>
		<title>Extraer URLs de imágenes de una web</title>
		<link>http://www.tecnoretales.com/programacion/extraer-urls-de-imagenes-de-una-web/</link>
		<comments>http://www.tecnoretales.com/programacion/extraer-urls-de-imagenes-de-una-web/#comments</comments>
		<pubDate>Fri, 29 May 2009 06:55:15 +0000</pubDate>
		<dc:creator>Manel Pérez Mata</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[Expresiones Regulares]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.tecnoretales.com/?p=260</guid>
		<description><![CDATA[¿Nunca habeis necesitado extraer todas las URLs de las imágenes de una web? Pues con este script mostraremos por pantalla las rutas de todas las imágenes contenidas en la página $url
$url = &#34;http://www.elmejorcoche.com&#34;;

$html = file_get_contents($url);

preg_match_all(&#34;/&#60;img[\s]+[^&#62;]*?src[\s]?=[\s\&#34;\']+(.*\.([gif&#124;jpg&#124;png&#124;bmp&#124;jpeg&#124;tiff]{3,4}))[\&#34;\']+.*?&#62;/&#34;, $html, $images);

$images = $images[1];
$list = array();

foreach($images as $img) {
	echo $img.&#34;&#60;br&#62;&#34;;
}
Si tu versión de PHP es inferior a 4.3.0 (en primer [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>¿Nunca habeis necesitado extraer todas las URLs de las imágenes de una web? Pues con este script mostraremos por pantalla las rutas de todas las imágenes contenidas en la página <em>$url</em></p>
<pre class="brush: php;">$url = &quot;http://www.elmejorcoche.com&quot;;

$html = file_get_contents($url);

preg_match_all(&quot;/&lt;img[\s]+[^&gt;]*?src[\s]?=[\s\&quot;\']+(.*\.([gif|jpg|png|bmp|jpeg|tiff]{3,4}))[\&quot;\']+.*?&gt;/&quot;, $html, $images);

$images = $images[1];
$list = array();

foreach($images as $img) {
	echo $img.&quot;&lt;br&gt;&quot;;
}</pre>
<p>Si tu versión de PHP es inferior a 4.3.0 (en primer lugar te recomiendo pasar a PHP5) puedes usar la siguiente función en lugar de <em>file_get_contents</em>:</p>
<pre class="brush: php;">function getHtml($url) {
    $foo = @fopen($url,&quot;r&quot;);
    if($foo){
        while(!feof($foo)){
            $html.=fgets($foo);
        }
    }
    return $html;
}</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.tecnoretales.com/programacion/extraer-urls-de-imagenes-de-una-web/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
