Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2007, 12:57 PM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Grabbing info from a url...

is it possible to grab certain information from a url that is entered in a forum and insert the collected info into the database.

urgently needed.

also is it possible to upload files and when they are downloaded they can be compressed such as download as zip / rar ?

thx.
Reply With Quote
  #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
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:48 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03183 seconds
  • Memory Usage 2,228KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete