note 65891 added to function.substr
| From: | piskopat at gmail dot com | Date: | Tue, 09 May 2006 23:28:01 +0000 |
| Subject: | note 65891 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-110971@lists.php.net to get a copy of this message | ||
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 ;)
----
Server IP: 85.111.4.6
Probable Submitter: 85.107.101.68
----
X-Spam-Status: No, hits=4.0 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_20_30,HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- http://master.php.net/note/edit/65891
Del: integrated -- http://master.php.net/note/delete/65891/integrated
Del: useless -- http://master.php.net/note/delete/65891/useless
Del: bad code -- http://master.php.net/note/delete/65891/bad+code
Del: spam -- http://master.php.net/note/delete/65891/spam
Del: non-english -- http://master.php.net/note/delete/65891/non-english
Del: in docs -- http://master.php.net/note/delete/65891/in+docs
Del: other reasons-- http://master.php.net/note/delete/65891
Reject -- http://master.php.net/note/reject/65891
Search -- http://master.php.net/manage/user-notes.php