<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php imdb mymovies mashup Archives - The Story of David Kaspar</title>
	<atom:link href="https://blog.davidkaspar.com/archives/tag/php-imdb-mymovies-mashup/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.davidkaspar.com/archives/tag/php-imdb-mymovies-mashup</link>
	<description>Online journal and ponderings about the Internet, gadgets and photography.</description>
	<lastBuildDate>Thu, 08 Jun 2006 08:20:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://blog.davidkaspar.com/wp-content/uploads/2020/05/chubby.gif</url>
	<title>php imdb mymovies mashup Archives - The Story of David Kaspar</title>
	<link>https://blog.davidkaspar.com/archives/tag/php-imdb-mymovies-mashup</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Scrape IMDB MyMovies with PHP</title>
		<link>https://blog.davidkaspar.com/archives/2006/06/scrape-imdb-mymovies-with-php.php</link>
					<comments>https://blog.davidkaspar.com/archives/2006/06/scrape-imdb-mymovies-with-php.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Thu, 08 Jun 2006 08:20:15 +0000</pubDate>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[php imdb mymovies mashup]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2006/06/08/scrape-imdb-mymovies-with-php/</guid>

					<description><![CDATA[<p>I have been wanting to somehow mention the movies I have recently seen and what I thought of them on this blog but was not sure how to best do it. For a while I was running my own custom code to add movie data and ratings and to display them but this was too &#8230; <a href="https://blog.davidkaspar.com/archives/2006/06/scrape-imdb-mymovies-with-php.php" class="more-link">Continue reading<span class="screen-reader-text"> "Scrape IMDB MyMovies with PHP"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2006/06/scrape-imdb-mymovies-with-php.php">Scrape IMDB MyMovies with PHP</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" alt="pimp.png" src="http://blog.davidkaspar.com/images/pimp.png" width="203" height="187" class="framedalignleft"/>I have been wanting to somehow mention the movies I have recently seen and what I thought of them on this blog but was not sure how to best do it.<br />
For a while I was running my own custom code to add movie data and ratings and to display them but this was too cumbersome.<br />
Recently I discovered that the movie rating system at <a href="http://www.IMDB.com">IMDB.com</a> keeps track of all the movies you have ever rated (<a href="http://www.IMDB.com">IMDB.com</a> is by the way an amazing resource for movie lovers and I hope that you have used it before).<br />
Since IDMB is the oracle of movies a better approach seemed to be to continue reviewing and discussing movies on there and attempt to mash the data into my blog.<br />
A few regular expressions later and a <em>Pick IMDB MyMovies with PHP</em> (PIMP) script was born.<br />
The script scrapes a given <a href="http://mymovies.imdb.com/mymovies/list">IMDB MyMovies</a> list and provides the results in a handy (two dimensional) array. It is up to the user to then write the display code to make it fit in with a web page (blog).<br />
A basic file based cache has been implemented to save on the amount of hits on IMDB.<br />
At the core of the script is the following regular expression:<br />
<code>/&lt;a href=\&quot;\/title\/([^\/]*)\/([^&gt;]*)&gt;([^&lt;]*)&lt;\/a&gt; \(([0-9]*[\/I]*)\)( \(.\))?&lt;\/td&gt;([^&lt;])&lt;td align=\&quot;center\&quot; bgcolor=\&quot;\#ffffff\&quot;&gt;([0-9]{1,2})&lt;\/td&gt;&lt;td align=\&quot;center\&quot; bgcolor=\&quot;\#ffffff\&quot;&gt; ([0-9]\.[0-9])?/i</code><br />
Be aware that if the layout of the IMDB page changes, PIMP will fail. Of course I will be quick to update the regular expression since I am using PIMP my self.<br />
There are some <a href="http://crschmidt.net/blog/archives/85/exhaustion-with-rdf/" rel="nofollow">rumours that IMDB will introduce an open API</a> that will allow developers to retrieve all kinds of movie information. Until that is done, crude HTML scraping techniques will have to do.<br />
Feel free to suggest regular expression or code optimisations.<br />
<a href="http://code.davidkaspar.com/PickMyImdbMovies_v1.2.zip">Download PIMP v1.2</a> and let me know what you think!<br />
Usage:<br />
&#8212;&#8212;<br />
0. Create an account with IMDB and mark a MyMovies list as public<br />
1. To be able to use a cache file create a directory which is writable by the script process (may need chmod 666). For security reasons this directory should be OUTSIDE of the area accessible from the web.<br />
2. Configure the script with your details (list id, cache directory and etc)<br />
3. Upload the <em>myImdbMovies.php</em> file to your web server<br />
4. Access the script directly or better yet use it as an include<br />
<u>Update 26/06/2006</u><br />
Added a raw HTTP method if file_get_contents doesn&#8217;t work for you (hosting provider restriction.<br />
-1 cache time out will skip caching altogether and avoid possible cache file permission problems.<br />
-1 for listItems will result in all items being returned</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2006/06/scrape-imdb-mymovies-with-php.php">Scrape IMDB MyMovies with PHP</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2006/06/scrape-imdb-mymovies-with-php.php/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
