PHP Classes
elePHPant
Icontem

File: IMDbFetch.example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of teo rusu  >  IMDb Fetch  >  IMDbFetch.example.php  >  Download  
File: IMDbFetch.example.php
Role: Example script
Content type: text/plain
Description: example of use
Class: IMDb Fetch
Fetch information about movies from the IMDb site
Author: By
Last change: added cast retrieving function
Date: 7 years ago
Size: 2,551 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IMDbFetch example</title>
<meta http-equiv="Expires" content="Sat, 13 Dec 2003 12:59:00 GMT"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<?php
/**********************************\
||================================||
|| ||
|| IMDbFetch v0.3 ||
|| IMDbFetch.php ||
|| | ||
|| - how to use example - ||
|| by teo rusu ||
|| spinicrus@gmail.com ||
|| http://- :) not yet, no time ||
|| ||
||================================||
\\************************/////////
                         /////////
                        /////////
//
require_once("imdbFetch.class.php");
//
//
$imdbLink = "http://www.imdb.com/title/tt0259711/";
//
$imdbGet = new IMDbFetch($imdbLink);
//
echo '<br/>'.$imdbGet->id;
echo
'<br/>'.$imdbGet->name;
echo
'<br/>'.$imdbGet->year;
echo
'<br/>'.$imdbGet->directed_by;
echo
'<br/>'.$imdbGet->writing_credits;
echo
'<br/>'.$imdbGet->genre;
echo
'<br/>'.$imdbGet->rating;
echo
'<br/>'.$imdbGet->runtime;
echo
'<br/>'.$imdbGet->comment;
echo
'<hr/>';
echo
'<pre>';
//
// IMDb cast:
//
// every position in the array
// contains an array with:
// 1. ['name_id'] -> the id of the "vip"
// from the imdb site; you can use it
// like http://www.imdb.com/name/nm.['name_id']./
// 2. ['name'] -> name of the "vip"
// 3. ['character'] -> name of the character
// from the movie/show
//
$imdbCast = $imdbGet->getCast();
print_r($imdbCast);
//
echo '</pre>';
echo
'<hr/>';
//show the poster image:
$imdbGet->displayPoster();
//
// IMDb poster image:
//
$imdbImage = $imdbGet->poster_image;
//
$imageData = $imdbImage[0];
$imageExtension = $imdbImage[1];
//
// THE IMAGE from imdb comes as an array:
// [0] contains the binary data;
// [1] contains the image extension;
//
// ... and it's intended for storing into database.
//
// for retrieving the image from database, please
// refer to this link:
// http://www.google.com/search?q=mysql+image+storing ;)
// (it's fairly easy to do it)
//
//
// and that's it !
// enjoy!
//
?>
</body>
</html>