Hola, tengo un problema con este codigo y no me funciona, me gustaria que me dijeran que puede llegar a ser, ya que siempre me retorna 0 valores.
Lo que estoy queriendo hacer es mediante una palabra que me devuelva las imagenes de una busqueda de google.
Código PHP:
Ver original<?php
//get the word submitted from the form
$word = "universo";
$img_pattern = "#<img src=http\S* width=[0-9]* height=[0-9]*>#";
// validate the word
if ($word != '') {
// initialise the session
// Set the URL
curl_setopt($ch, CURLOPT_URL
, "http://images.google.com/images?gbv=1&hl=en&sa=1&q=".urlencode($word)."&btnG=Search+images"); // Return the output from the cURL session rather than displaying in the browser.
//Execute the session, returning the results to $curlout, and close.
//display the results - I'll leave the formatting to you
print("Resultado de la busqueda $word: ".sizeof($img_tags[0])."<br/>\n");
foreach ($img_tags[0] as $val){
print(" ".$val."\n");
}
}
?>
Desde ya muchas gracias