PHP code example of wangqs / movie-info

1. Go to this page and download the library: Download wangqs/movie-info library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wangqs / movie-info example snippets


    $config = [
        'channel' => 1,      //Search by Douban ID (1) or IMDB ID (2)
        'baseUrl' => 'Fill in the basic path of Douban API here', //这里填入豆瓣API的基础路径
        'apiKey'  => 'Fill in apikey of Douban', //这里填入豆瓣的apikey
        'returnsFormat'  => 'json', //这里设置返回数据的格式(默认是数组 可不填),填入json 如果返回为数组的化,则自动转化为json
	];

    $movie = new Wangqs\Movie\Movie('imdbId or dbId',$config);

    //details info 详细信息
    $info = $movie->all();

    //original info 原始信息
    $info = $movie->original();

    //movie title (you can setting true get details title by array)  传参true 可以获取到更多的标题信息
    $title = $movie->title(true);  //Basis(false) or details(true)

    //movie rating array
    $rating = $movie->rating();

    //movie pub date of year
    $year = $movie->year();

    //photo  (you can setting true get details title by array)  传参true 可以获取到更多的信息
    $photo = $movie->photo(false); //Basis(false) or details(true)

    //intro 详细介绍
    $intro = $movie->intro();

    //genres    分类
    $genres = $movie->genres();

    //actors    演员
    $actors = $movie->actors();

    //directors     导演
    $directors = $movie->directors();

    //tags      标签
    $tags = $movie->tags();

    //durations 电影时长
    $runtime = $movie->runtime();

    //Publishing region (country) 发布地区(国家)
    $countries = $movie->countries();