Hello,
I made an IMDb scraper library to get movie information for a project that i’m working on. And thought I would share it. A quick note, IMDB.com does not allow scraping their site… If this doesn’t bother you(I didn’t), then you can proceed.
Here are some of the main features:
*Diffrent scrape options to refine your results
*Includes a light mode to make searching faster
*Youtube trailer url in the final results, also has options available in the config
*More to follow…
Example code:
application/controller/search_controller.php
//Load the scraper library
$this->load->library('imdb');
//Check if the query is submitted
if(isset($this->input->post('query'))) {
$query = $this->input->post('query'); //Put the query in a variable
$data['moviedetails'] = $this->imdb->getMovieInfo($query); //Get the movie information
}
//Set the page title
$data['title'] = 'IMDb Search Page';
//Load the view and pass along the data
$this->load->view('search_view', $data);application/views/search_view.php
<!DOCTYPE html>
<head>
<title><?php echo $title;></title>
</head>
<body>
<form method="post">
<input type="text" name="query">
<input type="submit" value="Search">
</form>
<?php
if(isset($moviedetails)){
foreach($moviedetails as $detail){
echo '<pre>';
print_r($detail);
echo '/<pre>';
}
}
?>
</body>If there any bugs, please report them. Thank you.
Also, if you have any ideas, suggestions etc, let me know and I’ll try to incorparate them.