Location: PHPKode > scripts > IMDb_Fetch > imdb_fetch/example1.php
<?php
/*
	The lines under will not be documentet. It's only an example of use.
	
	IMPORTANT!:
	Remember all! DO NOT use this if you haven't checked with IMDb's licensing.
*/

mysql_connect('localhost', '***', '***');
mysql_select_db('imdb');

// UTF-8 Fix
header('Content-Type: text/html; charset=utf-8');

if($imdb->activate_mysql_cache) {
	mysql_query("SET NAMES utf8");
}
?>
<form action="" method="post">
	<label for="movie"><span>Movie title</span>
		<input type="text" name="movie" id="movie" value="<?php echo $_POST['movie']; ?>" />	
	</label>
	<br />
	<?php 
	$in = array ('Year', 'Director', 'Genre', 'Tagline', 'Plot',
	'Keywords', 'Cast', 'Runtime', 'Country', 'Rating',
	'Poster', 'Votes', 'Language', 'All details');
	
	$out = '';
	$template = '
	<label for="%1$s">
		<input type="checkbox" name="show[]" value="%1$s" id="%1$s" %3$s /> %2$s
	</label>';
	$i = 1;
	foreach ($in as $show) {
		$lowered = strtolower(str_replace(' ', '_', $show));
		$checked = (isset($_POST['show'][0]) && in_array($lowered, $_POST['show'])) ? 'checked="checked"' : '';
		$out .= sprintf($template, $lowered, $show, $checked);
		if(!($i++%4)) {
			$out .= '<br />';
		}
	}
	echo $out;
	?>
	
	<p><input type="submit" name="fetch" value="Fetch" /></p>
</form>


<?php
if(!empty($_POST['movie'])) {

	$imdb = new IMDb_Fetch();
	$imdb->add_movie($_POST['movie']);

	if(isset($_POST['show'][0])) {
		if(in_array('all_details', $_POST['show'])) {
			$imdb->all_details = true;
		} else {

			foreach ($_POST['show'] as $show_me) {
				if(in_array($show_me, $_POST['show'])) {
					$imdb->{"show_{$show_me}"} = true;
				}
			}
		}
	}

	$imdb->activate_mysql_cache = true;


	$arr = $imdb->get_result_array();
	echo '<pre>';
	print_r($arr);
	echo '</pre>';
}
?>
Return current item: IMDb_Fetch