Go Back   CodingForums.com > :: Server side development > PHP > Post a PHP snippet

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-18-2012, 07:10 PM   PM User | #466
Lanibox
New to the CF scene

 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Lanibox is an unknown quantity at this point
Quote:
Originally Posted by drakus View Post
on line 121 change of VideoConverter.class.php
Code:
$percent = round($downloaded/$downloadSize, 2) * 100;
to

Code:
$percent = @round($downloaded/$downloadSize, 2) * 100;
than on line 230 same file, change

Code:
if ($vidSrc !== false && eregi('eow-title',$vidSrc))
to

Code:
if ($vidSrc !== false && preg_match('eow-title$/i',$vidSrc))
Thank should fix it.
Thanks, but now it gets stuck to this "Error downloading video!" Says that on every video... Before changing those 2 lines, it worked.
Lanibox is offline   Reply With Quote
Old 09-18-2012, 09:14 PM   PM User | #467
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Lanibox View Post
Im getting this error at Site5 hosting...
Any help?

Code:
[18-Sep-2012 11:54:57] PHP Deprecated:  Function eregi() is deprecated in /home/tubeconv/public_html/VideoConverter.class.php on line 230
[18-Sep-2012 11:54:57] PHP Deprecated:  Function eregi() is deprecated in /home/tubeconv/public_html/VideoConverter.class.php on line 230
[18-Sep-2012 11:54:58] PHP Warning:  Division by zero in /home/tubeconv/public_html/VideoConverter.class.php on line 121
[18-Sep-2012 11:54:58] PHP Warning:  Division by zero in /home/tubeconv/public_html/VideoConverter.class.php on line 121
Im using updated version of paid script.
If you turn off error reporting, then you won't see any of those warnings. (You should ALWAYS turn of error reporting on a live, production-level site. Hackers can use the info in error messages to cause harm to your site.)

At the top of index.php, I have already disabled error reporting via this line of code:

PHP Code:
ini_set('display_errors',0); 
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 09-18-2012, 09:25 PM   PM User | #468
Lanibox
New to the CF scene

 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Lanibox is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
If you turn off error reporting, then you won't see any of those warnings. (You should ALWAYS turn of error reporting on a live, production-level site. Hackers can use the info in error messages to cause harm to your site.)

At the top of index.php, I have already disabled error reporting via this line of code:

PHP Code:
ini_set('display_errors',0); 
Its not still gonna fix my problem im having... In previous page somebody gave me 2 lines to change, then it got stuck to downloading and it gives me "Error downloading video" message. Before changing those lines it got stuck to converting.

Any idea whats wrong?
Lanibox is offline   Reply With Quote
Old 09-18-2012, 09:36 PM   PM User | #469
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Lanibox View Post
Its not still gonna fix my problem im having... In previous page somebody gave me 2 lines to change, then it got stuck to downloading and it gives me "Error downloading video" message. Before changing those lines it got stuck to converting.

Any idea whats wrong?
So if you change the code back to the way it was, and you disable error reporting, you still have trouble with converting?

First of all, I strongly suggest that you search this forum thread for ways to troubleshoot this issue. I have addressed this problem many times before.

Second, what is the URL of your site? (Is the site live and online?) I can take a quick look...Also, you could paste a copy of a FFmpeg log file from a failed conversion, and I can see if there are any issues there.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 09-19-2012, 01:36 AM   PM User | #470
drakus
New Coder

 
Join Date: Feb 2012
Posts: 24
Thanks: 0
Thanked 3 Times in 3 Posts
drakus is an unknown quantity at this point
Quote:
Originally Posted by Lanibox View Post
Its not still gonna fix my problem im having... In previous page somebody gave me 2 lines to change, then it got stuck to downloading and it gives me "Error downloading video" message. Before changing those lines it got stuck to converting.

Any idea whats wrong?
Those 2 lines fix for php 5.2 which is way outdated. If a host is still using it, than do not use them, it's a sign of no security updates. centrix is running cpanel which always uses the lateste version of apache2 & php5.3 or 5.4 now.

I tell you a secret, if the server is misonfigured or heavily configured like mine is for major speed and caching, it most likely will not work. I set up another server defaulted with some security to it and works great.

google page speed messes with it, APC as well memcache(d) as well.

for $20 - $30 a month you can get your own VPS from a decent provider and won't be oversold. if you are looking to advance beyond shared hosting, i suggest it.
drakus is offline   Reply With Quote
Old 09-21-2012, 12:21 AM   PM User | #471
Luckyplaya
New Coder

 
Join Date: Sep 2012
Location: Germany
Posts: 32
Thanks: 8
Thanked 1 Time in 1 Post
Luckyplaya is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
Looking good!

It should be fairly straightforward to add additional converted file types...Was it for you?
Thanks

Yes it was very easy

PHP Code:
protected $_convertedFileTypes = array(
            
=> array(
                
'fileExt' => 'flv',
                
'mimeType' => 'video/x-flv',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec libmp3lame -ab %quality%k -vcodec libx264 -vpre veryfast -vb %vquality%k %newFile% 2> logs/%id%.txt'
            
),
            
=> array(
                
'fileExt' => 'mp4',
                
'mimeType' => 'video/mp4',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec libmp3lame -ab %quality%k -vcodec libx264 -vpre veryfast -vb %vquality%k %newFile% 2> logs/%id%.txt'
            
),
            
=> array(
                
'fileExt' => 'mp3',
                
'mimeType' => 'audio/mpeg3',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec libmp3lame -ab %quality%k %newFile% 2> logs/%id%.txt',
                
'quality' => '192',
                
'checked' => 'checked'
            
),
            
=> array(
                
'fileExt' => 'mp3',
                
'mimeType' => 'audio/mpeg3',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec libmp3lame -ab %quality%k %newFile% 2> logs/%id%.txt',
                
'quality' => '320'
                     
),
            
=> array(
                
'fileExt' => 'aac',
                
'mimeType' => 'audio/aac',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec libfaac -ab %quality%k %newFile% 2> logs/%id%.txt',

            ),
            
=> array(
                
'fileExt' => '3gp',
                
'mimeType' => 'video/3gpp',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec copy -ab %quality%k -vcodec libx264 -vpre veryfast %newFile% 2> logs/%id%.txt'
                     
),
            
=> array(
                
'fileExt' => 'avi',
                
'mimeType' => 'video/avi',
                
'ffmpeg' => '%ffmpeg% -i %tempFile% -vol %volume% -y -acodec libmp3lame -ab %quality%k -vcodec libxvid -vb 1000k %newFile% 2> logs/%id%.txt'

            
)
        ); 
Luckyplaya is offline   Reply With Quote
Old 09-21-2012, 01:35 PM   PM User | #472
blacktiger786
New Coder

 
Join Date: May 2012
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
blacktiger786 is an unknown quantity at this point
please tell me how to fix download files size limit
like limit on 10mb files when file above 10mb its not download
help me please
blacktiger786 is offline   Reply With Quote
Old 09-21-2012, 05:37 PM   PM User | #473
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by blacktiger786 View Post
please tell me how to fix download files size limit
like limit on 10mb files when file above 10mb its not download
help me please
I have already answered this question here: http://www.codingforums.com/showpost...&postcount=433

If you want me to implement this for you, I will have to charge you to do this custom work at my hourly rate. Please contact me privately if you are interested.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 09-24-2012, 03:47 PM   PM User | #474
Komshir
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Komshir is an unknown quantity at this point
i'm getting this error:

Parse error: syntax error, unexpected T_FUNCTION in /home/admin/domains/xxx.xx[real domain]/public_html/youtubedown/VideoToMp3Converter/YouTubeToMp3Converter.class.php on line 188

the line is $url = preg_replace_callback('/(&type=)(.+?)(&)/', function($match){return $match[1].urlencode($match[2]).$match[3];}, $url);

i enabled error_reporting.

the script is not working
Komshir is offline   Reply With Quote
Old 09-25-2012, 04:30 AM   PM User | #475
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Komshir View Post
i'm getting this error:

Parse error: syntax error, unexpected T_FUNCTION in /home/admin/domains/xxx.xx[real domain]/public_html/youtubedown/VideoToMp3Converter/YouTubeToMp3Converter.class.php on line 188

the line is $url = preg_replace_callback('/(&type=)(.+?)(&)/', function($match){return $match[1].urlencode($match[2]).$match[3];}, $url);

i enabled error_reporting.

the script is not working
What version of PHP are you running? You need at least PHP 5.3 for anonymous functions to work as type "callable" arguments. I'm guessing that is the source of your error.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 09-25-2012, 07:44 PM   PM User | #476
Komshir
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Komshir is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
What version of PHP are you running? You need at least PHP 5.3 for anonymous functions to work as type "callable" arguments. I'm guessing that is the source of your error.
I'm running php5.2, can i somehow replace it with different function?
Komshir is offline   Reply With Quote
Old 09-25-2012, 10:06 PM   PM User | #477
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Komshir View Post
I'm running php5.2, can i somehow replace it with different function?
You could replace with create_function, but this is not the only part of the code that requires PHP 5.3. For example, the download/conversion progress bar will not work with PHP 5.2.

I highly recommend that you either upgrade to 5.3 or find another server/hosting company that supports 5.3. As "drakus" noted earlier, recently, in this thread:

Quote:
If a host is still using it [PHP 5.2], than do not use them, it's a sign of no security updates.
That about sums it up...
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 09-27-2012, 08:06 AM   PM User | #478
dareweb
New to the CF scene

 
Join Date: Sep 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
dareweb is an unknown quantity at this point
I'm struggling to find a hosting with proper ffmpeg
Either they have PHP 5.2 or they just mention ffmpeg but don't have it on the server..
Any suggestions?
dareweb is offline   Reply With Quote
Old 09-27-2012, 08:45 AM   PM User | #479
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by dareweb View Post
I'm struggling to find a hosting with proper ffmpeg
Either they have PHP 5.2 or they just mention ffmpeg but don't have it on the server..
Any suggestions?
My suggestion is to opt for a VPS, cloud, or dedicated server. This type of plan will give you more control over your environment and is more suited to resource-intensive sites. You basically install whatever you want. There are some reasonably priced VPS/cloud hosting plans out there, but you have to be willing to spend more than you would for shared hosting. With a VPS, you will be able to install at least PHP 5.3/FFmpeg/ffmpeg-php extension, and you could even compile it yourself via a simple web interface if your plan includes WHM/cPanel (if you aren't comfortable with SSH and the comand line interface)...
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 09-27-2012, 10:14 AM   PM User | #480
dareweb
New to the CF scene

 
Join Date: Sep 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
dareweb is an unknown quantity at this point
After 2 days searching, applying and claiming my money back from several hosters I finally found one with ffmpeg and PHP 5.3

It is HostForWeb
http://www.hostforweb.com/1873.html
It will cost you $6.36 for 1 month when you use promotional code "autumn"
I think it is a good choice for those who want to test their scripts first before applying for more serious hosting.

Script is working properly.
dareweb is offline   Reply With Quote
Reply

Bookmarks

Tags
audio, class, conversion, dailymotion, ffmpeg, mp3, php, script, video, youtube

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 10:17 PM.


Advertisement
Log in to turn off these ads.