dziewalex Posted January 12, 2013 Share Posted January 12, 2013 (edited) I am currently stuck on getting vidfetch to work with my current website. I am trying to make the code work with my current website. This is how far i got and i do not know what is wrong with it. the java appelt loads up but thats even before i click download it whould load up once i have hit download then it would generate the links for me. but it dosnt do that it loads the java applet uses credit on vidfetch and nothing else. Here is the code i modifed to "work" with my site. <?php require_once "maincore.php";require_once THEMES."templates/header.php"; $url = $_POST['url']; $siteURL = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/'; $bookmarklet = 'javascript:document.location.href=\'' . $siteURL . '?url=\'+escape(document.location.href)'; function getApplet($jarFile, $className, $params = array(), $width=1, $height=1, $name='japplet') { $retVal = ""; $useApplet = 0; $user_agent = $_SERVER['HTTP_USER_AGENT']; if (stristr($user_agent, "konqueror") || stristr($user_agent, "macintosh") || stristr($user_agent, "opera")) { $useApplet = 1; $retVal = sprintf('<applet name="%s" id="%s" archive="%s" code="%s" width="%s" height="%s" MAYSCRIPT >', $name, $name, $jarFile, $className, $width, $height); } else { if (strstr($user_agent, "MSIE")) { $retVal = sprintf('<object name="%s" id="%s" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" style="border-width:0;" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab#version=1,4,1" width= "%s" height= "%s">', $name, $name, $width, $height); } else { $retVal = sprintf('<object name="%s" id="%s" type="application/x-java-applet;version=1.4.1" width= "%s" height= "%s">', $name, $name, $width, $height); } $params['archive'] = $jarFile; $params['code'] = $className; $params['mayscript'] = 'true'; $params['scriptable'] = 'true'; $params['name'] = $name; } foreach ($params as $var => $val) { $retVal .= sprintf('<param name="%s" value="%s">', $var, $val); } $retVal .= 'It appears you do not have Java installed or it is disabled on your system.<br /> Please download it <a href="http://www.java.com/getjava/" class="link" target="_blank">here</a>'; if ($useApplet == 1) { $retVal .= '</applet>'; } else { $retVal .= '</object>'; } return $retVal;} opentable("Download"); echo"$url"; if (!empty($url)) { echo " <script type='text/javascript'> loaderVisible = true; VFResult = ''; VFProxy = ''; VFThumbnail = ''; function vidfetchSearching() { $('#japplet').width(1); $('#japplet').height(1); $('#vidfetchSearching').show(); } function vidfetchAppend(type,name,index,title) { if(loaderVisible) { $('#vidfetchSearching').hide(); $('#vidfetchLinks').show(); loaderVisible = false; } name = name.replace('Download','Download'); // does name have extension else append it if(name.indexOf(type) < 0) { name += '('+type+')'; } var proxyLink = VFProxy+index+'/'+title+'.'+type.toLowerCase(); $('.vtitle').html(title); if(VFThumbnail.length > 0) { $('.vimage img').attr('src',VFThumbnail); $('.vimage').show(); } if(type == 'MP3') { $('#vidfetchLinks ul.audio').append('<li class='type'+type+''><a href=''+proxyLink+''><span>'+name+'</span></a></li>'); } else { $('#vidfetchLinks ul.video').append('<li class='type'+type+''><a href=''+proxyLink+''><span>'+name+'</span></a></li>'); } } function vidfetchDone() { if(!loaderVisible) { // set thumbnail return; } $('#vidfetchSearching').hide(); $('#vidfetchError').show(); } function vidfetchProxy(url) { } function vidfetchError() { $('#vidfetchSearching').hide(); $('#vidfetchError').show(); } </script> <div id='vidfetchSearching' style=':none;'> <center> <img src='assets/loader.gif'> </center> </div> <div id='vidfetchLinks' style='display:none;'> <div class='productHeadingType4'> <div class='vtitle'></div> <div class='vimage' style='diaplay:none;'><img src=''></div> <div class='cfloat1'><div class='cfloat2'> <ul class='audio'></ul> </div></div> <div class='clear'></div> <div class='previewWarning'>When downloading please do not close/exit this page.</div> </div> </div> <div id='vidfetchLoader'> <center>"; echo getApplet('http://vidfetch.com/java/VidFetchApplet.signed.jar', 'VidFetchApplet.class', array('url' => $url, 'userAgent' => $_SERVER['HTTP_USER_AGENT']), 100, 100); echo " </center> </div> Please make sure you selected yes when prompted for '<b>Always trust content from the publisher</b>'.</span> </div>";} echo " <form action='' method='GET' name='download' id='download'> <input type='text' name='url' value='$url'> <a href='#' onclick='document.forms['download'].submit();'> <span>Download Now</span> </a> </form> <div id='java-required'> Please make sure you have java installed.Select Allow when prompted. </div> </div> </div> </div>"; closetable(); require_once THEMES."templates/footer.php";?> Here is the Original Code - <?php/* * ***************************************************************************** * * ****************************************************************************** * Website: http://www.vidfetch.com * * Copyright: (c) 20011 - Baseapp Systems * * ****************************************************************************** * VERION HISTORY: * * v0.4 [15.3.2011] - Rewrite for VidFetch * v0.3 [22.3.2010] - Rewrite * v0.2 [5.3.2010] - Added Exception Handling * v0.1 [15.11.2009] - Initial Version * * ****************************************************************************** * DESCRIPTION: * * NOTE: See www.vidfetch.com for the most recent version of this script * and its usage. * * ****************************************************************************** */ $siteURL = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/'; $bookmarklet = 'javascript:document.location.href=\'' . $siteURL . '?url=\'+escape(document.location.href)'; function getApplet($jarFile, $className, $params = array(), $width=1, $height=1, $name='japplet') { $retVal = ""; $useApplet = 0; $user_agent = $_SERVER['HTTP_USER_AGENT']; if (stristr($user_agent, "konqueror") || stristr($user_agent, "macintosh") || stristr($user_agent, "opera")) { $useApplet = 1; $retVal = sprintf('<applet name="%s" id="%s" archive="%s" code="%s" width="%s" height="%s" MAYSCRIPT >', $name, $name, $jarFile, $className, $width, $height); } else { if (strstr($user_agent, "MSIE")) { $retVal = sprintf('<object name="%s" id="%s" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" style="border-width:0;" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab#version=1,4,1" width= "%s" height= "%s">', $name, $name, $width, $height); } else { $retVal = sprintf('<object name="%s" id="%s" type="application/x-java-applet;version=1.4.1" width= "%s" height= "%s">', $name, $name, $width, $height); } $params['archive'] = $jarFile; $params['code'] = $className; $params['mayscript'] = 'true'; $params['scriptable'] = 'true'; $params['name'] = $name; } foreach ($params as $var => $val) { $retVal .= sprintf('<param name="%s" value="%s">', $var, $val); } $retVal .= 'It appears you do not have Java installed or it is disabled on your system.<br /> Please download it <a href="http://www.java.com/getjava/" class="link" target="_blank">here</a>'; if ($useApplet == 1) { $retVal .= '</applet>'; } else { $retVal .= '</object>'; } return $retVal; } if (isset($_GET['url']) && !empty($_GET['url'])) { if (strstr($_GET['url'], 'http')) { $url = $_GET['url']; } else { $error = "Invalid url please enter valid video url."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Your Site Title</title> <meta name="description" content="Download and Convert videos directly from Youtube, Google, Metacafe and more. Simply copy and paste." /> <meta name="keywords" content="freevid, keep, vid, keep vid, download, direct, help, rip, copy, convert , youtube to mo3 , save, video, stream, youtube, yuotube, toutube, uoutube, houtube" /> <!-- Framework CSS --> <link rel="stylesheet" href="assets/screen.css" type="text/css" media="screen, projection"> <!--[if lt IE 8]><link rel="stylesheet" href="assets/ie.css" type="text/css" media="screen, projection"><![endif]--> <link rel="stylesheet" href="assets/theme.css" type="text/css" media="screen, projection"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> </head> <body> <div id="header"> <div class="container"> <a href="?"> <div id="logo"> <strong>Your</strong> Site Name </div> </a> <div id="bookmark"> <a href=""> <img src="assets/bookmark.gif" /></a> </div> </div> </div> <div id="content"> <div id="content-upper"> <div id="content-upper-top"> <div class="container"> </div> </div> <div id="content-upper-bottom"> <div class="container"> <h1>Download and Convert Videos Instantly !!!</h1> <p> Just paste the URL of the video in the form below , press the Download button and see the magic happen. For making the process faster use our book marklet next time. </p> <?php if (!empty($url)) { ?> <script type="text/javascript"> loaderVisible = true; VFResult = ""; VFProxy = ""; VFThumbnail = ""; function vidfetchSearching() { $('#japplet').width(1); $('#japplet').height(1); $('#vidfetchSearching').show(); } function vidfetchAppend(type,name,index,title) { if(loaderVisible) { $('#vidfetchSearching').hide(); $('#vidfetchLinks').show(); loaderVisible = false; } name = name.replace("Low Quality","Low Quality"); name = name.replace("Medium Quality","Medium Quality"); name = name.replace("High Quality","High Quality"); // does name have extension else append it if(name.indexOf(type) < 0) { name += "("+type+")"; } var proxyLink = VFProxy+index+"/"+title+"."+type.toLowerCase(); $('.vtitle').html(title); if(VFThumbnail.length > 0) { $('.vimage img').attr('src',VFThumbnail); $('.vimage').show(); } if(type == 'MP3' || type == 'AAC') { $('#vidfetchLinks ul.audio').append('<li class="type'+type+'"><a href="'+proxyLink+'"><span>'+name+'</span></a></li>'); } else { $('#vidfetchLinks ul.video').append('<li class="type'+type+'"><a href="'+proxyLink+'"><span>'+name+'</span></a></li>'); } } function vidfetchDone() { if(!loaderVisible) { // set thumbnail return; } $('#vidfetchSearching').hide(); $('#vidfetchError').show(); } function vidfetchProxy(url) { } function vidfetchError() { $('#vidfetchSearching').hide(); $('#vidfetchError').show(); } </script> <div id="vidfetchSearching" style="display:none;"> <center> <img src="assets/loader.gif"> </center> </div> <div id="vidfetchLinks" style="display:none;"> <div class="productHeadingType4"> <div class="vtitle"></div> <div class="vimage" style="diaplay:none;"><img src=""></div> <div class="cfloat1"><div class="cfloat2"> <ul class="video"></ul> <ul class="audio"></ul> </div></div> <div class="clear"></div> <div class="previewWarning">When downloading please do not close/exit this page.</div> </div> </div> <div id="vidfetchLoader"> <center> <?php echo getApplet('http://vidfetch.com/java/VidFetchApplet.signed.jar', 'VidFetchApplet.class', array('url' => $url, 'userAgent' => $_SERVER['HTTP_USER_AGENT']), 100, 100); ?> </center> </div> <div id="vidfetchError" style="display:none;"> <span style="color: rgb(204, 51, 51);"><b>No Videos found or site not supported.</b><br /> Please make sure you selected yes when prompted for '<b>Always trust content from the publisher</b>'.</span> </div> <?php } ?> <?php if (isset($error) && !empty($error)) { ?> <center><span class="invalidUrl"><?php echo $error; ?> </span></center><br/> <?php } ?> <div id="download-form"> <form action="" method="GET" id="download"> <input type="text" name="url" value="<?= isset($url) ? $url : 'Enter Video URL ...'; ?>" onclick="if(this.value == 'Enter Video URL ...')this.value='';"> <a href="#" onclick="document.forms['download'].submit();"> <span>Download Now</span> </a> </form> </div> <div id="java-required"> Please make sure you have java installed.Select Allow when prompted. </div> </div> </div> </div> <div id="content-lower"> <div class="container"> <ul class="features"> <li> <h3>Lots of Formats </h3> <p>All the popular formats for like FLV , AVI , Mp4 , Mp3 , AAC are supported. </p> <li> <li> <h3>No Waiting !!!</h3> <p>Instantly download and convert videos no waiting , no setups or anything.</p> </li> <li> <h3>Lots of Sites</h3> <p>We support over 100+ sites for Video downloading and are constantly growing.</p> </li> </ul> </div> </div> </div> <div class="fader"> </div> <div id="footer"> <div class="container"> <div id="footer-links"> <!-- Do not remove powered by link if you are a free user of vidfetch --> Powered By <a href="http://vidfetch.com">VidFetch</a> , © Your Site </div> </div> </div> <div class="container"> </div> </body> </html> Thanks Edited January 12, 2013 by dziewalex Quote Link to comment https://forums.phpfreaks.com/topic/273077-integrating-vidfetch-with-my-current-website/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.