I have tried making a from and wrote a script that fetch image from google but it does not display any image nor it gives any error what shall i do. here is my code.
<html>
<head>
<title>Images</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="Post">
<table border="1">
<tr>
<td>Text:</td>
<td><input type="text" name="image" id="ImageType" value=""></td>
<td><input type="Submit" value="Click to Submit"></td>
</tr>
</table>
</form>
<br>
</body>
</html>
<?php
include "simple_html_dom.php";
if(isset($_POST['submit']))
{
$search_query = $_POST['image'];
// $search_query = "love";
$search_query = urlencode( $search_query );
$html = file_get_html( "https://www.google.com/search?q=$search_query& tbm=isch" );
// $image_container = $html->find('div#rcnt', 0);
$images = $html->find('img');
$image_count = 10; //Enter the amount of images to be shown
$i = 0;
foreach($images as $image){
if($i == $image_count) break;
$i++;
// DO with the image whatever you want here (the image element is '$image'):
echo $image;
}
}
?>