Saturday, April 10, 2010

Free Printable Vintage Papers

Data mining


If you need information to find film or imdb.com or hkmdb.com provide an API or similar allows to find data quickly and easily. This is a shit, so I wrote some php functions that use cURL to mine data from the html directly.

Movies iPhone application allows you to catalog movies with lots of options, but much better than loading them one by one by hand, is the function that has to import data from a xml. In my particular case, the data of my movies are in a MySQL database owner is not compatible with Movies. For this reason I had to write a php that generates the xml compatible and decided to use data from IMDB and HKMDB \u200b\u200bto complete missing in my base.

http://www.netwalkapps.com/content/movies

For IMDB can search by one or more words by passing a string to the function imdb_search (), the string may contain spaces. If all goes well the function will return a string with the path to a title on imdb.com that may or may not be the one you want. If your search produces more than one result php take the first option presented. This is not always the best option but nobody is perfect. HKMDB \u200b\u200bworks the same with hkmdb_search ().

Once you have a valid url of a title on imdb or hkmdb, it passed to the function imdb_get () / hkmdb_get (). If all goes well the function should return an associative array with collected data. For these data IMDB title, year, description, director, country, duration, gender, language, and alternative titles. For these data HKMDB \u200b\u200btitle, year, country, genre and director. IMDB

GET accepts searches. But HKMDB \u200b\u200bsearches made by POST, and has an unfriendly track with some redirects. So included is a useful feature I found to do POST with cURL.

Bear in mind that if HKMDB \u200b\u200band / or modify the provision IMDB and / or a search function can be rendered useless. Parse html tags depends on specific in a specific order.



0 comments:

Post a Comment