Bueno, voy a ponerlo un poco más fácil: Buscando y buscando por la red, he encontrado el siguiente código en PHP que hace lo siguiente: Abre un sencillo formulario donde se le introduce un nombre y entonces realiza una búsqueda en la web
http://images.google.com, mostrando los resultados en la propia página. Lo que no sé es como coger alguna de esas imágenes (por ejemplo, las tres primeras que aparecen) y luego GUARDARLAS en una carpeta local.
Si me podéis ayudar en este menester, el resto por lo que he podido ver en este foro y en
www.desarrolloweb.com, me podría apañar.
Os transcribo el código y os animo a que lo probéis. Es bastante curioso:
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<body>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" id="table1">
<tr>
<td>
<font face="Verdana"><b>Web Image Search & Grabber v 1.00</b></font><form AUTOCOMPLETE = "off" method="POST" enctype="multipart/form-data">
<p><input type="text" name="imagesxsearch" size="29"> <input type="submit" value="Search" name="B1">
Page: <select size="1" name="D1">
<option selected value="&start=0">Page 1</option>
<option value="&start=20">Page 2</option>
<option value="&start=40">Page 3</option>
<option value="&start=60">Page 4</option>
<option value="&start=80">Page 5</option>
<option value="&start=100">Page 6</option>
<option value="&start=120">Page 7</option>
<option value="&start=140">Page 8</option>
<option value="&start=160">Page 9</option>
<option value="&start=180">Page 10</option>
<option value="&start=200">Page 11</option>
<option value="&start=220">Page 12</option>
<option value="&start=240">Page 13</option>
<option value="&start=260">Page 14</option>
<option value="&start=280">Page 15</option>
<option value="&start=300">Page 16</option>
<option value="&start=320">Page 17</option>
<option value="&start=340">Page 18</option>
<option value="&start=360">Page 19</option>
<option value="&start=380">Page 20</option>
</select> <input type="button" value="Close Window" name="close" onClick="window.close()"><p>
</p>
<p><input type="radio" value="V1" checked name="safeonoff">Safe Search on
<input type="radio" name="safeonoff" value="V2">*Safe Search Off </p>
<hr>
</form>
</td>
</tr>
</table>
<?
$searchspec =$_POST['imagesxsearch'];
$morepage =$_POST['D1'];
$safeonoff =$_POST['safeonoff'];
if ($safeonoff == 'V1'){
$saveonoff ='on';
}
if ($safeonoff == 'V2'){
$saveonoff ='off';
}
if (count ($searchspec) == 0){
$searchspec = $_GET['imagesxsearch'];
}
if (count ($searchspec) <> 0){
$searchspec = str_replace (' ','+',$searchspec);
$google ='http://images.google.com/images?hl=en&lr=&ie=UTF-8&safe='.$saveonoff.'&q='.$searchspec.'&btnG=Searc h'.$morepage;
$file = implode('', file($google));
$count = "0";
$file = explode('imgurl=',$file);
echo 'Last Search Phrase: '.$searchspec.'<br><br>';
foreach ($file as $listing) {
$count++;
$Start = '';
$GrabEnd = '&imgrefurl';
$content = $listing;
$stuff = eregi("$Start(.*)$GrabEnd", $content, $c);
$newcontent = $c[1];
if ($newcontent <> ""){
echo '<a target="_blank" href="'.$newcontent .'"> <img border="0" src="'.$newcontent .'" height="25%"></a> ';
}
}
}
?>
<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" id="table2">
<tr>
<td><hr>
<p align="center"><font face="Verdana" size="1">provided by
<a href="http://www.bestwebauctions.net">bestwebauctions.net</a></font><font face="Verdana" style="font-size: 6pt"><br>
</font>*<font size="1">You must be 18 to use this option</font></td>
</tr>
</table>
</body>
</html>
*********** FIN DEL CÓDIGO *****************
A ver si alguien puede echarme una mano.
Gracias.