Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/11/2008, 22:42
Suyta
(Desactivado)
 
Fecha de Ingreso: septiembre-2004
Mensajes: 360
Antigüedad: 19 años, 7 meses
Puntos: 1
Respuesta: Cambiar links en página capturada con file_get_contents

Lo que busco es cambiar el link y que al clickear sobre la imagen valla al sitio donde está la imagen y NO a Google.
Ahora me estoy acercando un poco más con esto, cambié algunas cosas:

Código PHP:
$full='<a href="/imgres?imgurl=http://www.animalhealthfoundation.com/Images/beloved-horses.jpg&imgrefurl=http://www.animalhealthfoundation.com/about.html&h=600&w=800&sz=57&tbnid=ibidPAhcu4QJ::&tbnh=107&tbnw=143&prev=/images%3Fq%3Dhorses&hl=es&usg=__87z8GeCCkkG1C8l7DjD5Dv9M0LU=&sa=X&oi=image_result&resnum=1&ct=image&cd=1">
<img height="107" width="143" border="1" align="middle" title="http://www.animalhealthfoundation.com/about.html" alt="http://www.animalhealthfoundation.com/about.html" src="http://tbn0.google.com/images?q=tbn:ibidPAhcu4QJ::www.animalhealthfoundation.com/Images/beloved-horses.jpg"/>
</a>'
;

preg_match('/\/imgres([\w\W]*?)\>/',$full,$ftu);
  for (
$az=0$azcount($ftu[0]); $az++) {
    
$deko=$ftu[$az];

preg_match('/imgrefurl([\w\W]*?)h=/',$deko,$ftt2);
  for (
$r=0$rcount($ftt2[0]); $r++) {
  
print_r($ftt2);
  
$d22=$ftt2[$r];
  echo 
$d22;

  
$d22=str_replace("imgrefurl="""$d22);
  
$d22=str_replace("&h="""$d22);

  
$d23=str_replace($full'<a href="'.$d22.'>'.$full.'</a>'$full);

  
$d23=str_replace("&%3E%3Ca%20href="""$d23);



  echo 
$d23;

}

Estamos cerca pero me queda algo como esto:
http://globalwork.no-ip.org/google/testo.php

Es decir ahí podés ver que el link resulta esto:
Código HTML:
http://www.animalhealthfoundation.com/about.html&%3E%3Ca%20href=
Y no puedo eliminar esas 'basuritas'.