My favorites
▼
|
Sign in
torrentexpander
This script is designed to be a perfect companion to the Transmission torrent client and Flexget
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
20
attachment: imdbWebService.php
(2.3 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Free PHP IMDb Scraper Web Service API
// Author: Abhinay Rathore
// Website: http://www.AbhinayRathore.com
// Blog: http://web3o.blogspot.com
// Demo: http://lab.abhinayrathore.com/imdb/
// More Info: http://web3o.blogspot.com/2010/10/php-imdb-scraper-for-new-imdb-template.html
// Last Updated: July 3, 2011
/////////////////////////////////////////////////////////////////////////////////////////////////////////
include("imdb.php");
$movieName = $_REQUEST["m"];
$output = strtolower($_REQUEST["o"]);
if($output != "xml" && $output != "json" && $output != "jsonp"){
$output = "xml"; //Set default to XML
}
$i = new Imdb();
$mArr = array_change_key_case($i->getMovieInfo($movieName), CASE_UPPER);
///////////////[ XML Output ]/////////////////
if($output == "xml") {
header("Content-Type: text/xml;charset=iso-8859-1");
$doc = new DomDocument('1.0');
$doc->formatOutput = true;
$movie = $doc->createElement('MOVIE');
$movie = $doc->appendChild($movie);
foreach ($mArr as $k=>$v){
if(is_array($v)){
$node = $doc->createElement($k);
$node = $movie->appendChild($node);
$c = 0;
foreach($v as $a){
$c++;
$child = $doc->createElement($k . "_");
$child = $node->appendChild($child);
$child->setAttribute('n', $c);
$value = $doc->createTextNode($a);
$value = $child->appendChild($value);
}
} else {
$node = $doc->createElement($k);
$node = $movie->appendChild($node);
$value = $doc->createTextNode($v);
$value = $node->appendChild($value);
}
}
$xml_string = $doc->saveXML();
echo $xml_string;
} //End XML Outout
///////////////[ JSON Output ]/////////////////
if($output == "json") {
header('Content-type: application/json');
echo json_encode($mArr);
} //End JSON Outout
///////////////[ JSONP Output ]/////////////////
if($output == "jsonp") {
header('Content-type: application/json');
echo isset($_GET['callback']) ? $_GET['callback']."(". json_encode($mArr) .")" : json_encode($mArr);
} //End JSONP Outout
?>
Powered by
Google Project Hosting