Ver Mensaje Individual
  #13 (permalink)  
Antiguo 06/11/2013, 10:48
Avatar de satanson123
satanson123
 
Fecha de Ingreso: julio-2012
Mensajes: 217
Antigüedad: 11 años, 9 meses
Puntos: 2
Respuesta: error con https con file_get_contents()

Cita:
Iniciado por jonni09lo Ver Mensaje
Me lo imaginé, entonces debes alterar la logica de la funcion. Algo asi:

Código PHP:
Ver original
  1. function getUrl($text){
  2.     preg_match_all("#<a href=\"(.*?)\">(.*?)<\/a>#", $text, $matches);
  3.     return $matches;
  4. }
  5.  
  6. function getTitle($content){
  7.     $matches = getUrl($content);
  8.    
  9.     $titles = array();
  10.    
  11.     if( isset($matches[1]) && !empty($matches[1]) ){
  12.         $counnt = count($matches[1]);
  13.         for($i = 0; $i < $counnt; $i++){
  14.             $str = file_get_contents($matches[1][$i]);
  15.             if(strlen($str)>0){
  16.                 preg_match("/\<title\>(.*)\<\/title\>/",$str,$title);
  17.                 $titles[] = $title[1];
  18.             }
  19.         }
  20.     }
  21.     return $titles;
  22. }

Saludos
Gracias, tu codigo me lanza esto:
Código PHP:
http://www.gratisprogramas.us/descarga/la-contrasena-mas-usada-en-adobe-resulto-ser-123456/" width="16" height="16"> 
pero solo quiero cojer esto:

Código PHP:
http://www.gratisprogramas.us/descarga/la-contrasena-mas-usada-en-adobe-resulto-ser-123456/