Ver Mensaje Individual
  #4 (permalink)  
Antiguo 06/04/2009, 12:02
Acanore
 
Fecha de Ingreso: abril-2009
Ubicación: Incomoda
Mensajes: 30
Antigüedad: 17 años, 7 meses
Puntos: 0
Respuesta: Cojer una parte de una página web

Listo, ya termine... consultando un poco y haciendo algunas pruebas he obtenido esto

- Una función que me ayudara a buscar las etiquetas y obtener los valores que quiera (src, href, etc)

Código PHP:
@$text = $_POST["url"];

/*=========================================================*/
function medio($ini, $fin, $texto){
    
$x = explode($ini, $texto);
    for(
$i=1; $i<count($x); $i++){
        
$x2 = explode($fin, $x[$i]);
        
$z[$i-1] = $x2[0];
    }
    return 
$z;
}
/*========================================================*/ 
- El código para abrir la url y agregarla a una variable

Código PHP:
    $gestor = fopen($text, "rb");
    
$texto = '';
    while (!
feof($gestor)) {
      
$texto .= fread($gestor, 8192);
    } 
- Aquí utilizo las funciones (de casualidad alguien conoce una función que ya haga esto en PHP?)

Código PHP:
$links = medio("<a ", "</a>", $texto);
$partes = medio("src=\"", "\"", $texto);