Location: PHPKode > scripts > IMDB Parser > imdb-parser/example-curl.php
<?php
/*
* Example using curl
*/

//get a video detail site from imdb.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://imdb.com/title/tt0138704/'); //movie PI
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);

$imdb_website = $output;

//include the parser-class
require("classes/class.imdb_parser.php");

//init the class
$IMDB_Parser = new IMDB_Parser;

// output movie-picture (html)
print "<p>".$IMDB_Parser->getMoviePictureHtml($imdb_website)."</p>";

// output movie-title
print "<br />Title: ".$IMDB_Parser->getMovieTitle($imdb_website);

// output movie-tagline
print "<br />Tagline: ".$IMDB_Parser->getMovieTagline($imdb_website);

// output movie-plot
print "<br />Plot: ".$IMDB_Parser->getMoviePlot($imdb_website);

// output movie-actors (array)
print "<br />Actors: ";
foreach($IMDB_Parser->getMovieActors($imdb_website) as $value)
{
    print $value." | ";
}

// output movie-user rating
print "<br />User Rating: ".$IMDB_Parser->getMovieRating($imdb_website);

// output movie-languages (array)
print "<br />Languages: ";
foreach($IMDB_Parser->getMovieLanguage($imdb_website) as $value)
{
    print $value." | ";
}

// output movie-color
print "<br />Color: ".$IMDB_Parser->getMovieColor($imdb_website);

// output movie-country (array)
print "<br />Country: ";
foreach($IMDB_Parser->getMovieCountry($imdb_website) as $value)
{
    print $value." | ";
}

// output movie-directed by
print "<br />Directed by: ".$IMDB_Parser->getMovieDirectedBy($imdb_website);

// output movie-picture path
print "<br />Picture Path: ".$IMDB_Parser->getMoviePicture($imdb_website);

// output movie-genres (array)
print "<br />Genres: | ";
foreach($IMDB_Parser->getMovieGenres($imdb_website) as $value)
{
    print $value." | ";
}
Return current item: IMDB Parser