How to fix my IMDB Script


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to fix my IMDB Script
# 1  
Help me to fix my IMDB Script

Hello,

I am using IMDB bot file for my movie site..

But I get this message like this---Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in /home/u653954634/public_html/wp-content/plugins/WB-IMDB/bot.php on line 238

Can anyone fix this in my script..

Here the script
Code:
<?php
function save_image( $inPath, $outPath )
{
    $in = fopen( $inPath, "rb" );
    $out = fopen( $outPath, "wb" );
    while ( $chunk = fread( $in, 8192 ) )
    {
        fwrite( $out, $chunk, 8192 );
    }
    fclose( $in );
    fclose( $out );
}

function get_seo_link( $str, $replace = array( ), $delimiter = "-" )
{
    setlocale( LC_ALL, "en_US.UTF8" );
    if ( !empty($replace) )
    {
        $str = str_replace( ( array )$replace, " ", $str );
    }
    else
    {
        $trArr = array( "", "", "ı", "İ", "ş", "Ş", "ğ", "Ğ", "", "", "", "" );
        $toArr = array( "c", "c", "i", "i", "s", "s", "g", "g", "o", "o", "u", "u" );
        $str = str_replace( $trArr, $toArr, $str );
    }
    $clean = iconv( "UTF-8", "ASCII//TRANSLIT", $str );
    $clean = preg_replace( "/[^a-zA-Z0-9\\/_|+ -]/", "", $clean );
    $clean = trim( $clean );
    $clean = preg_replace( "/[\\/_|+ -]+/", $delimiter, $clean );
    $clean = mb_strtolower( $clean, "UTF-8" );
    return $clean;
}

function bot_starten( )
{
    global $rootp;
    global $burl;
    global $wpdb;
    include( "slugs.php" );
    echo "<center><h1>Full Movie Archives IMDB Bot</h1><hr style=\"width:50%;border:2px solid #000;\" /><form action=\"edit.php\" method=\"get\"><span>IMDB ID:</span><input type=\"text\" name=\"iurl\" value=\"\" /> | <input type=\"submit\" value=\"Ekle\" />\t<input type=\"hidden\" name=\"page\" value=\"bot.php\" /></form>";
    $theme_name = get_template_directory( );
    $l = "<a href=\"http://www.fullmoviearchives.com\" rel=\"dofollow\" title=\"Full Movie\">Full Movie</a>";
    $f = $theme_name."/footer.php";
    $fd = fopen( $f, "r" );
    $c = fread( $fd, filesize( $f ) );
    fclose( $fd );
    if ( !preg_match( "#".$l."#", $c ) )
    {
        echo "<p>This plugin is only available at www.doynet.com, Full Movie Archives Theme, works with. Or the footer.php file, <strong>&lt;a href=\"http://www.fullmoviearchives.com\" rel=\"dofollow\" title=\"full movie\"&gt;Full Movie&lt;/a&gt; </strong> code to add.\r\n</p>";
        exit( );
    }
    if ( !empty( $_GET['iurl'] ) )
    {
        $ch = curl_init( );
        curl_setopt( $ch, CURLOPT_URL, "http://www.imdb.com/title/".$_GET['iurl']."/" );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
        curl_setopt( $ch, CURLOPT_REFERER, "http://www.google.com/" );
        $data = curl_exec( $ch );
        if ( preg_match( "#<h1 class=\"header\" itemprop=\"name\">(.*?)\\((.*?)\\)(.*?)</h1>#si", $data, $matches ) )
        {
            preg_match( "#<h4 class=\"inline\">Country:</h4>(.*?)</div>#si", $data, $counarr );
            preg_match( "#<div class=\"infobar\">(.*?)</div>#si", $data, $infobar );
            preg_match_all( "#href=\"/genre/(.*?)>(.*?)</a>#si", $infobar[1], $cats );
            preg_match( "#(.*?)min#si", $infobar[1], $timearr );
            preg_match( "#<h4 class=\"inline\">(.*?)Director:(.*?)</h4>(.*?)</div>#si", $data, $directarr );
            preg_match_all( "#href=\"/name/(.*?)>(.*?)</a>#si", $wriarr[3], $fwarrs );
            preg_match( "#<div class=\"star-box-giga-star\">(.*?)</div>#si", $data, $scoaa );
            preg_match( "#<p itemprop=\"description\">(.*?)</p>#si", $data, $idarr );
            $title = strip_tags( $matches[1] );
            $year = strip_tags( $matches[2] );
            $desc = trim( preg_replace( "/\\s+/", " ", strip_tags( $idarr[1] ) ) );
            $imdbp = trim( preg_replace( "/\\s+/", " ", strip_tags( $scoaa[1] ) ) );
            $country = explode( "|", trim( preg_replace( "/\\s+/", " ", strip_tags( $counarr[1] ) ) ) );
            $cats = $cats[2];
            $ftime = trim( preg_replace( "/\\s+/", " ", strip_tags( $timearr[1] ) ) )." min";
            $fdirect = trim( preg_replace( "/\\s+/", " ", strip_tags( $directarr[3] ) ) );
            curl_setopt( $ch, CURLOPT_URL, "http://www.imdb.com/title/".$_GET['iurl']."/fullcredits" );
            $odata = curl_exec( $ch );
            preg_match( "#Produced by(.*?)(Cinematography by|Original Music by)#si", $odata, $proarr );
            preg_match_all( "#<a href=\"/name/(.*?)\">(.*?)</a>(.*?)</tr>#si", $proarr[1], $opro );
            $poi = 0;
            foreach ( $opro[3] as $oyaz )
            {
                if ( preg_match( "#>producer</a>#si", $oyaz ) )
                {
                    if ( $poi == 0 )
                    {
                        $produ .= $opro[2][$poi];
                    }
                    else
                    {
                        $produ .= ", ".$opro[2][$poi];
                    }
                }
                ++$poi;
            }
            preg_match( "#Original Music by(.*?)>(.*?)</a>#si", $odata, $omus );
            $omusic = trim( preg_replace( "/\\s+/", " ", strip_tags( $omus[2] ) ) );
            preg_match( "#Cinematography by(.*?)>(.*?)</a>#si", $odata, $ocb );
            $ocby = trim( preg_replace( "/\\s+/", " ", strip_tags( $ocb[2] ) ) );
            preg_match( "#<table class=\"cast_list\">(.*?)</table>#si", $data, $cataa );
            preg_match_all( "#<td class=\"name\">(.*?)href=\"/name/(.*?)>(.*?)</a>#si", $cataa[1], $casta );
            $all_cast = $casta[3];
            preg_match( "#Writing credits(.*?)<table class=\"cast\">#si", $odata, $wriar );
            preg_match_all( "#<a href=\"/name/(.*?)>(.*?)</a>#si", $wriar[1], $wrial );
            $fwrites = trim( preg_replace( "/\\s+/", " ", implode( ",", $wrial[2] ) ) );
            curl_setopt( $ch, CURLOPT_URL, "http://www.imdb.com/title/".$_GET['iurl']."/releaseinfo" );
            $rdata = curl_exec( $ch );
            preg_match( "#<a href=\"/calendar/\\?region=US\">USA</a>(.*?)</tr>#si", $rdata, $rcarr );
            $rdate = preg_replace( "#\\((.*?)\\)#si", "", trim( preg_replace( "/\\s+/", " ", strip_tags( $rcarr[1] ) ) ) );
            $my_post = array( );
            $my_post['post_title'] = $title;
            $my_post['post_content'] = $desc;
            $my_post['post_status'] = "draft";
            $my_post['post_author'] = 1;
            $my_post['post_category'] = NULL;
            $post_id = wp_insert_post( $my_post );
            if ( $post_id )
            {
                $doarray = array( $array_slugs['yil-slug'] => $year, $array_slugs['sure-slug'] => $ftime, $array_slugs['yonetmen-slug'] => $fdirect, $array_slugs['muzik-slug'] => $omusic, $array_slugs['yapimci-slug'] => $produ, $array_slugs['senaryo-slug'] => $fwrites, $array_slugs['imdb-puani-slug'] => $imdbp, $array_slugs['goruntu-yonetmeni-slug'] => $ocby, $array_slugs['cikis-tarih-slug'] => $rdate );
                foreach ( $doarray as $value => $key )
                {
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" ) ) == 0 )
                    {
                        insert( "{$wpdb->terms}", array( "name" => "".$key."", "slug" => "".get_seo_link( $key )."" ), array( "%s", "%s" ) );
                        $yid = $wpdb->insert_id;
                    }
                    else
                    {
                        $ys = get_row( "SELECT term_id FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" );
                        $yid = $ys->term_id;
                    }
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='{$value}'" ) ) == 0 )
                    {
                        query( "INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'{$value}')" );
                        $ytid = $wpdb->insert_id;
                    }
                    else
                    {
                        $yts = get_row( "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='{$value}'" );
                        $ytid = $yts->term_taxonomy_id;
                    }
                    query( "INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (".$post_id.",".$ytid.")" );
                }
                foreach ( $cats as $key )
                {
                    $key = trim( preg_replace( "/\\s+/", " ", strip_tags( $key ) ) );
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" ) ) == 0 )
                    {
                        insert( "{$wpdb->terms}", array( "name" => "".$key."", "slug" => "".get_seo_link( $key )."" ), array( "%s", "%s" ) );
                        $yid = $wpdb->insert_id;
                    }
                    else
                    {
                        $ys = get_row( "SELECT term_id FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" );
                        $yid = $ys->term_id;
                    }
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='".$array_slugs['tur-slug']."'" ) ) == 0 )
                    {
                        query( "INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'".$array_slugs['tur-slug']."')" );
                        $ytid = $wpdb->insert_id;
                    }
                    else
                    {
                        $yts = get_row( "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='".$array_slugs['tur-slug']."'" );
                        $ytid = $yts->term_taxonomy_id;
                    }
                    query( "INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (".$post_id.",".$ytid.")" );
                }
                foreach ( $all_cast as $key )
                {
                    $key = str_replace( "&nbsp;", "", $key );
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" ) ) == 0 )
                    {
                        insert( "{$wpdb->terms}", array( "name" => "".$key."", "slug" => "".get_seo_link( $key )."" ), array( "%s", "%s" ) );
                        $yid = $wpdb->insert_id;
                    }
                    else
                    {
                        $ys = get_row( "SELECT term_id FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" );
                        $yid = $ys->term_id;
                    }
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='".$array_slugs['oyuncu-slug']."'" ) ) == 0 )
                    {
                        query( "INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'".$array_slugs['oyuncu-slug']."')" );
                        $ytid = $wpdb->insert_id;
                    }
                    else
                    {
                        $yts = get_row( "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='".$array_slugs['oyuncu-slug']."'" );
                        $ytid = $yts->term_taxonomy_id;
                    }
                    query( "INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (".$post_id.",".$ytid.")" );
                }
                foreach ( $country as $key )
                {
                    $key = str_replace( "&nbsp;", "", $key );
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" ) ) == 0 )
                    {
                        insert( "{$wpdb->terms}", array( "name" => "".$key."", "slug" => "".get_seo_link( $key )."" ), array( "%s", "%s" ) );
                        $yid = $wpdb->insert_id;
                    }
                    else
                    {
                        $ys = get_row( "SELECT term_id FROM {$wpdb->terms} WHERE slug='".get_seo_link( $key )."'" );
                        $yid = $ys->term_id;
                    }
                    if ( get_var( prepare( "SELECT COUNT(term_id) FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='".$array_slugs['ulke-slug']."'" ) ) == 0 )
                    {
                        query( "INSERT INTO {$wpdb->term_taxonomy} (term_id,taxonomy) VALUES ({$yid},'".$array_slugs['ulke-slug']."')" );
                        $ytid = $wpdb->insert_id;
                    }
                    else
                    {
                        $yts = get_row( "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id=".$yid." AND taxonomy='".$array_slugs['ulke-slug']."'" );
                        $ytid = $yts->term_taxonomy_id;
                    }
                    query( "INSERT INTO {$wpdb->term_relationships} (object_id,term_taxonomy_id) VALUES (".$post_id.",".$ytid.")" );
                }
                echo "<p style=\"background-color:green;color:white;padding:10px;width:60%;\"><a style=\"color:white;\" href=\"post.php?post=".$post_id."&action=edit\" target=\"_blank\">".$title."</a> added.</p>";
            }
        }
        curl_close( $ch );
    }
}

function yonetime_ekleen( )
{
    add_submenu_page( "edit.php", "Full Movie Archives IMDB BOT", "Full Movie Archives IMDB BOT", 10, basename( __FILE__ ), "bot_starten" );
}

$rootp = $_SERVER['DOCUMENT_ROOT'];
$burl = site_url("http://www.imdb.com\");

add_action( 'admin_menu', 'yonetime_ekleen' );
?>


Last edited by lg2013; 04-17-2013 at 03:55 PM..
# 2  
That cannot be your entire script.

Since you didn't post your entire script, I do not know which is line 246.
# 3  
total script submitted.

Now it show ---Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in /home/u653954634/public_html/wp-content/plugins/WB-IMDB/bot.php on line 238
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #859
Difficulty: Medium
AJAX is designed for two-way client-server communications.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to 'improve' this script and also 'fix' the pattern matching part?

Hi all, Below is my script. It is currently working but I want some advice on maybe improving it and need some help on the pattern matching xx.ksh: #!/bin/ksh # # ------------------------------------------------------------------------------------------------- # #Fatal NI connect error... (3 Replies)
Discussion started by: newbie_01
3 Replies

2. UNIX for Dummies Questions & Answers

How to fix connection to Oracle database through shell script?

I have a question regarding how to connect to Oracle Database through shell script. 1. If I want call a stored procedure on Linux server as this, it works. $sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 12 14:49:49 2015 Copyright (c) 1982, 2014, Oracle. All rights... (2 Replies)
Discussion started by: duke0001
2 Replies

3. Shell Programming and Scripting

Need help fix my script to get alerts when the command produce n expected output

Hi, Below is my script, which is used to invoke a test using curl command. #/usr/bin/sh MAILTO=user@xyz.com URL='https://myserver.xyz.net/test/dir/test123.tws' SOAPFILE=/tmp/soap.txt curl -k -s -S --header 'Content-Type: text/xml;charset=UTF-8' --data @"${SOAPFILE}" "${URL}" ... (3 Replies)
Discussion started by: System Admin 77
3 Replies

4. Shell Programming and Scripting

Fix script to get missing information

Gents, Can you please help me to fix the following script in order to get complete data as desired. I am missing some data in output. the complete input file is attached. The script I am using is awk '{\ status=substr($0,91,2)\ ind=substr($0,26,1);\ ... (10 Replies)
Discussion started by: jiam912
10 Replies

5. UNIX for Dummies Questions & Answers

How to fix Python path for some script/app?

Hello, i have: # python -V Python 2.7.6 But original for my CentOS is 2.3 or 2.4 my python folder: /root/python2.7.6 (inside are folders like lib, include, bin, share) I launched app iotop: # iotop -od 6 Traceback (most recent call last): File "/usr/bin/iotop", line 16, in... (3 Replies)
Discussion started by: postcd
3 Replies

6. Shell Programming and Scripting

My script failed and can't fix it ?

Hi , I'd like to give you a little bit idea about my script which is used to get any generated file from remote server using ftp session then organized those file into directories based on their date ( at the end I supposed to have 1 months directories 20130401 20130402 ....20130430 ,... (27 Replies)
Discussion started by: arm
27 Replies

7. UNIX for Dummies Questions & Answers

Please help to fix awk script

Good morning, fellows. I would need to ask for your help in editing my awk script. Here is the original version: BEGIN { printf ("CRYST1 200.000 200.000 200.000 90.00 90.00 90.00 P 1 1\n") maxatoms=1000 natom=0 found_struct = 0 found_bond = 0 } { if( NF == 5 ) { foundff=0 natom++... (9 Replies)
Discussion started by: snysmumrik
9 Replies

8. Windows & DOS: Issues & Discussions

Fix script error (%%n)

Hi, I'm currently tinkering with a script that uses the for command to process all *.gif files in the current folder. I marked the spot where it exits out with an error by adding a "pause" The error message given is: convert.exe: unable to open image `%x': No such file or directory @... (2 Replies)
Discussion started by: pasc
2 Replies

9. Shell Programming and Scripting

how to fix this awk script?

i have a log file while looks like this ++ user_a blabla blabla nas_b blabla user_d this is a user_a junk line another junk line user_c nas_m blabla ++ basically most of the lines contain a "user" keywords, and the rest of the lines do not have "user" at all. So I have the... (17 Replies)
Discussion started by: fedora
17 Replies

10. Shell Programming and Scripting

fix a problem in this script

z=9 i=0 h=02 min=55 while do cat /home/barmecha/test | grep $h:$min >> /home/barmecha/file1 min=`expr $min + 1` if ; then h=`expr $h + 1` fi i=`expr $i + 1` done i have a log file with time wise log in it, this script help me to pull out logs of the give time interval...but the... (8 Replies)
Discussion started by: abhishek27
8 Replies

Featured Tech Videos