View Single Post
  #2  
Old 06-15-2007, 08:58 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone able to help

heres the functions is it possilble for anyone to fix it to work.

PHP Code:
function getIMDbInfo($title
{
    global 
$vbulletin;
    
    
$movie=searchIMDb($title);

    
$movie_title=$movie['aResult'][0][0];
    
$movie_id=$movie['aResult'][0][1];
    
$movie_year=$movie['aResult'][0][2];

    if(
$movie['title_or_find']) {
        
$movie=$movie['aResult'];
        
$movieurl="http://www.imdb.com/title/".$movie_id."/";
    }
    else {
        
$movie=$movie['aResult'];
        
$movieurl="http://www.imdb.com/find?q=".urlencode($title)."/";
    }
    
    
$content=file_get_contents($movieurl);
    
$poster_delim1="title=\"".twoDelimitersIMDb($content"<title>"" (")."\" src=\"";
    
    if(!
$movie['title_or_find']) {
        
$movie_title=twoDelimitersIMDb($content"<title>"" (");
        
$movie_id=preg_match("/title\/tt([0-9]*)\//"$content);
        
$movie_year=fulhackIMDb($content"/Sections/Years/""</a>");
        
        
//id
        
$pattern_id="/title\/tt([0-9]*)\/ratings/";
        
preg_match($pattern_id$content$movie_id);
        
$movie_id="tt".$movie_id[1];
    }
        
    
//--plot----------------------------------------
    
$pattern_summary="/\<b class=\"ch\"\>Plot Summary\:/";
    
$pattern_outline="/\<b class=\"ch\"\>Plot Outline:/";
    
    
    if(
preg_match($pattern_summary$content)||preg_match($pattern_outline$content)) {
        
$pattern_plotsummary="/plotsummary\/title\/".$movie_id."\/plotsummary/";
        
$pattern_morelank="/plotsummary\"\>\(more\)\<\/a\>/";
        if(
preg_match($pattern_plotsummary$content)) {
            
$content_plot=file_get_contents("http://www.imdb.com/title/".$movie_id."/plotsummary");
            
$plot=twoDelimitersIMDb($content_plot"<p class=\"plotpar\">""</p>");
        }
        else {
            if(
preg_match($pattern_outline$content)) {
                
$plot=twoDelimitersIMDb($content"Plot Outline:</b>""<");
            }
            else if(
preg_match($pattern_summary$content)) {
                
$plot=twoDelimitersIMDb($content"Plot Summary:</b>""<");
            }
        }
    }
    
    
    
//----------------------------------------------
    
$array=array(
        
"title"     => $movie_title,
        
"id"        => $movie_id,
        
"plot"      => $plot,
    );
    
    return 
$array;
}



function 
searchIMDb($sTitle) {        
    
$sPage file_get_contents($sTitle);

    
$aResult = array();
    if(
preg_match("/IMDb  Search/"$sPage)) {
        
preg_match_all("/<a href=\"\/title\/([^\/]*)\/([^>]*)>([^<]*)<\/a> \(([0-9]*)\)([^\<]*)/i"$sPage$aMatches);
        
$nLen count($aMatches[0]);

        for(
$i 0;$i $nLen;$i++) {
            
            
$sType trim($aMatches[5][$i]);
            
            if(
$sType != "") {
                continue;
            }
        
            
$aResult[] = array($aMatches[3][$i], $aMatches[1][$i], $aMatches[4][$i]);
        }
        
        
$id=$aResult[0][1];
        
$movieurl="http://www.imdb.com/title/".$id."/";
        
$result=array(
            
"aResult"           => $aResult,
            
"title_or_find"     => 1,
        );
    }
    
    else {
        
$movieurl="http://www.imdb.com/find?q=".urlencode($sTitle)."/";
        
$result=array(
            
"aResult"           => $aResult,
            
"title_or_find"     => 0,
        );
    }
    
    return 
$result;
}



function 
twoDelimitersIMDb($content$delim1$delim2) {
    
$len1=strlen($delim1);
    if(
strpos($content$delim1)) {
        
$start=strpos($content$delim1)+$len1;
        
$end=strpos(substr($content$start), $delim2)+$start;
        
$length=$end-$start;
        
$content=substr($content$start$length);
    }
    
    if(!
preg_match("/imdb\-online/"$content)) {
    return 
$content;
    }
}


function 
fulhackIMDb($content$delim1$delim2) {
    
$content=twoDelimitersIMDb($content$delim1$delim2);
    
$pos=strpos($content">")+1;
    
    return 
substr($content$pos);
}

  
$movieinfo=getIMDbInfo($_POST['imdburl']);
  eval(
'print_output("' fetch_template('TEST') . '");');

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01083 seconds
  • Memory Usage 1,860KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete