note 65891 deleted from function.substr by bjori
| From: | bjori@php.net | Date: | Wed, 10 May 2006 00:56:25 +0000 |
| Subject: | note 65891 deleted from function.substr by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-111008@lists.php.net to get a copy of this message | ||
Note Submitter: piskopat at gmail dot com
Reason: useless
----
getting film information from imdb by imdb id;
<?php
if(!isset($_POST["imdb"]))
die("
<html>
<form action=imdb.php method=post>
<table>
<tr><td>imdb no:</td><td><input type=text
name=imdb></td></tr>
<tr><td></td><td><input type=submit name=yukle
value='getir'></td></tr>
</table>
</form>
</html>
");
$html = implode('', file('http://www.imdb.com/title/'.$_POST["imdb"]));
$strName=substr($html, (strpos($html,'class="title">')+14),
(strpos($html,'<small>',strpos($html,'class="title">')) -
(strpos($html,'class="title">')+14)));
$strYear=substr($html, (strpos($html,'<a
href=',(strpos($html,'class="title">')))+31),
(strpos($html,'</a>',strpos($html,'class="title">')) -
(strpos($html,'<a
href=',(strpos($html,'class="title">')))+31)));
$strGenre=substr($html, (strpos($html,'<b
class="ch">Genre:</b>')+24),
(strpos($html,'<br>',strpos($html,'<b
class="ch">Genre:</b>')) - (strpos($html,'<b
class="ch">Genre:</b>')+24)));
$strRating=substr($html, (strpos($html,'<b>',(strpos($html,'<b
class="ch">User Rating:</b>')))),
((strpos($html,')',(strpos($html,'<b class="ch">User
Rating:</b>')))) - strpos($html,'<b>',strpos($html,'<b
class="ch">User Rating:</b>'))+1));
echo 'film name: ' . $strName . '<br>film year: ' . $strYear .
'<br>film genre: ' . $strGenre . '<br>film rating: ' . $strRating .
'<br>';
?>
save this code as "imdb.php" anywhere at your localhost.
call this page and forexample try this id: tt0266308
you will get important information to this (or your films) datas from imdb ;)