Title: IMDB ID
Last modified: August 22, 2016

---

# IMDB ID

 *  Resolved [Film Complet En Francais](https://wordpress.org/support/users/film-complet-en-francais/)
 * (@film-complet-en-francais)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/)
 * This code takes imdb movie id from custom field and uses it to print runtime.
 *     ```
       $imdbid = get_post_meta(get_the_ID(),'imdb-id',true);
       $connector_movie = get_imdb_connector_movie($imdbid);
       $minutes = $connector_movie["runtime"];
       $minutes  = preg_replace("'[^0-9]'", "", $minutes);
       $new_time = date("G:i:00", mktime(0, $minutes));
       echo "Runtime: " . $new_time;
       ```
   
 * This code works great, but when I choose an option to store movie cache in WordPress
   MySQL database it stops working and gives this message:
    `The movie tt2978462
   could not be found. Please check your spelling.` What could be the problem?
 * BTW, thanks for an option not to cache posters!:)
 * [https://wordpress.org/plugins/imdb-connector/](https://wordpress.org/plugins/imdb-connector/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [Film Complet En Francais](https://wordpress.org/support/users/film-complet-en-francais/)
 * (@film-complet-en-francais)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378228)
 * Code I provided doesn’t seem to work with v0.3, now it just prints 0:00:00 instead
   of actual movie runtime. Reverted to v0.2 and it works as it used to.
 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378322)
 * Thanks for your comment.
 * A few things have changed in 0.3 as I’ve mentioned in the change note. It was
   necessary and will be a lot easier to use in the long run.
 * You didn’t mention how you put the data into the post meta field. Actually there’s
   not even a need to use post meta fields since the information is either stored
   on your server or in your database (if you activated caching).
 * When using database caching, the selected movie details will be downloaded and
   put into a get_option() called “imdb_connector_cache”. When you call the movie
   details the next time, it’ll first look through the database and only download
   the information if they haven’t been saved yet.
 * So instead of using post meta, you could just use the regular `get_imdb_connector_movie_detail(
   $movie_title, $detail)`. Note that the structure of the returned array has changed
   a little bit, especially the “runtime” value. It’s now an array containing “minutes”,“
   hours” and “timestamp” ([see the documentation](https://wordpress.org/support/topic/imdb-id/www.koljanolte.com/wordpress/plugins/imdb-connector/?output_format=md#PHP functions)).
 *  Thread Starter [Film Complet En Francais](https://wordpress.org/support/users/film-complet-en-francais/)
 * (@film-complet-en-francais)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378345)
 * I’m writing imdb id into post custom field manually when publishing a post, so
   the custom field is called `imdb-id` and the value is `tt2978462`. The reason
   I want to use imdb id instead of movie title is that my movie titles are in foreign
   language, which omdbapi doesn’t support if I’m right?
 * How would you change the code I provided to work with v0.3 so it prints runtime
   correctly instead of zeros?
 *  Thread Starter [Film Complet En Francais](https://wordpress.org/support/users/film-complet-en-francais/)
 * (@film-complet-en-francais)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378349)
 * I understand the changes made, but my lack of understanding of PHP gives me trouble
   implementing it:/
 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378353)
 * No, it was my fault. I used a wrong variable at a crucial position in the code.
   I’ve just fixed it and updated the plugin. Please download the newest version
   and try again.
 * `print_r(get_imdb_connector_movie_detail("tt2978462", "runtime"));`
 * gives me:
 * > Array ( [timestamp] => 1412966859 [minutes] => 107 [hours] => 1:47 )
 *  Thread Starter [Film Complet En Francais](https://wordpress.org/support/users/film-complet-en-francais/)
 * (@film-complet-en-francais)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378354)
 * Now it’s working perfectly, thank you!:)
 *  Thread Starter [Film Complet En Francais](https://wordpress.org/support/users/film-complet-en-francais/)
 * (@film-complet-en-francais)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378355)
 * BTW, let’s say I have thousands of movies on my website, which is the better 
   way to store cache? As files or in database?
 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378368)
 * Good question… I really don’t know. Both have advantages and disadvantages. But
   I know too little about that to tell you something reliable here :p

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘IMDB ID’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/imdb-connector_bac675.svg)
 * [IMDb Connector](https://wordpress.org/plugins/imdb-connector/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/imdb-connector/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/imdb-connector/)
 * [Active Topics](https://wordpress.org/support/plugin/imdb-connector/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/imdb-connector/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/imdb-connector/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/imdb-id/#post-5378368)
 * Status: resolved