Skip to content

Instantly share code, notes, and snippets.

@bran921007
bran921007 / gist:24bbbd4a39df999bc20c
Created January 31, 2015 23:53
Extraer urls con PHP - expresion regular
<?php
$cadena = file_get_contents('http://www.taringa.net');
function extraerURLs($cadena){
$regex = '/https?\:\/\/[^\" ]+/i';
preg_match_all($regex, $cadena, $partes);
return ($partes[0]);
}
// Llamamos a la función y le pasamos la cadena a buscar