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 11-04-2012, 07:01 PM   PM User | #541
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Looks good, Luckyplaya...that is the general idea...although I would employ PHP constants instead of regular variables in my language files.

Quote:
but when I choose English and then convert a video , it automatically jumps to the default language (German) .
without looking closely, I would guess that you are not passing the GET variable 'lang' in the action of your conversion form...
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 11-04-2012, 08:47 PM   PM User | #542
Luckyplaya
New Coder

 
Join Date: Sep 2012
Location: Germany
Posts: 33
Thanks: 8
Thanked 1 Time in 1 Post
Luckyplaya is an unknown quantity at this point
Thank you. it was

I have the solution

Change
PHP Code:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="conversionForm" style="display:none; width:auto;">
to

PHP Code:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?lang=<?php echo $lang ?> " method="post" id="conversionForm" style="display:none; width:auto;">
and add in Language Files $lang = "de"; and $lang = "en";

Works Perfekt

Last edited by Luckyplaya; 11-04-2012 at 09:02 PM..
Luckyplaya is offline   Reply With Quote
Old 11-05-2012, 09:30 PM   PM User | #543
slaine
New Coder

 
Join Date: Nov 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
slaine is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
Have you modified my core code and/or the ffmpeg commands in any way? Can you post the full ffmpeg log file for a failed conversion? Are your failed conversions even generating log files? Your phpinfo looks ok....this is probably a ffmpeg or file permissions problem...If you can convert ok locally, then it's more likely a permissions or file ownership (chown) problem...
i tried some converting seems to work remote

http://snuthuset.se/fixed/ffmpeg/

still not yourscript doh
slaine is offline   Reply With Quote
Old 11-07-2012, 01:53 PM   PM User | #544
annejefferson
New to the CF scene

 
Join Date: Jul 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
annejefferson is an unknown quantity at this point
Hi R.J.
I have some fund now! I'm thinking of buying your script soon. Can you check your PM box please. How on earth to contact you directly? Do you mind giving me your email address please.
annejefferson is offline   Reply With Quote
Old 11-07-2012, 11:44 PM   PM User | #545
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by slaine View Post
i tried some converting seems to work remote

http://snuthuset.se/fixed/ffmpeg/

still not yourscript doh
I can't explain your server's (frequent?) inability to process remote access to my converter script. I honestly have never heard of an issue like yours up until now. It sounds like you have an unconventional server setup, in that you are trying to make your computer/server at home a node on the public internet. I can only suggest trying to install my software on a professionally configured and/or commercially hosted server, and see if you have the same results.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 11-08-2012, 02:41 PM   PM User | #546
Luckyplaya
New Coder

 
Join Date: Sep 2012
Location: Germany
Posts: 33
Thanks: 8
Thanked 1 Time in 1 Post
Luckyplaya is an unknown quantity at this point
How do you like my new style?

http://schwarzgelb.video2mp3.eu/index.php?lang=en
Luckyplaya is offline   Reply With Quote
Old 11-08-2012, 04:11 PM   PM User | #547
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Luckyplaya View Post
Solid.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 11-20-2012, 08:54 AM   PM User | #548
Luckyplaya
New Coder

 
Join Date: Sep 2012
Location: Germany
Posts: 33
Thanks: 8
Thanked 1 Time in 1 Post
Luckyplaya is an unknown quantity at this point
Hi chump,
can grab the javascript code to an external file?
so that it is no longer visible in the source code!

e.g. <script type="text/javascript" src="js/js.php"></script> ?
Luckyplaya is offline   Reply With Quote
Old 11-20-2012, 05:37 PM   PM User | #549
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Luckyplaya View Post
Hi chump,
can grab the javascript code to an external file?
so that it is no longer visible in the source code!

e.g. <script type="text/javascript" src="js/js.php"></script> ?
Did you answer your own question here:

Code:
<script type="text/javascript" src="js/js.php"></script>
What exactly are you trying to do?
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 11-20-2012, 09:26 PM   PM User | #550
Luckyplaya
New Coder

 
Join Date: Sep 2012
Location: Germany
Posts: 33
Thanks: 8
Thanked 1 Time in 1 Post
Luckyplaya is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
Did you answer your own question here:

Code:
<script type="text/javascript" src="js/js.php"></script>
What exactly are you trying to do?
Code:
<script type="text/javascript">
		var conversionLogLength = 0;

		function updateVideoDownloadProgress
...
This code I would like to put it in a external file for hidden in index.php.
But in this javascript php is also available, so I can not create a js file. If I create a php file and with <script type="text/javascript" src="js/js.php"> views, the converter will not be displayed.
Luckyplaya is offline   Reply With Quote
Old 11-20-2012, 11:22 PM   PM User | #551
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Luckyplaya View Post
Code:
<script type="text/javascript">
		var conversionLogLength = 0;

		function updateVideoDownloadProgress
...
This code I would like to put it in a external file for hidden in index.php.
But in this javascript php is also available, so I can not create a js file. If I create a php file and with <script type="text/javascript" src="js/js.php"> views, the converter will not be displayed.
If your javascript has PHP in it (in other words, the PHP is dynamically generating the Javascript), then you have to put it in a PHP or INC file. (I wouldn't use the INC file type unless your application is already using it by convention.)

In your situation it sounds like you will want to include the new PHP file (that contains your javascript) inside of index.php, i.e.:
PHP Code:
// somewhere in index.php
include 'someFolder/myNewFile.php'
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 11-21-2012, 05:43 PM   PM User | #552
soofi
New to the CF scene

 
Join Date: Jul 2012
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
soofi is an unknown quantity at this point
Randall, my site www.videotomp3online.org was working fine but since last few days I'm getting this video error.. can you tell me what is wrong here

http://videotomp3online.org/error.jpg
soofi is offline   Reply With Quote
Old 11-23-2012, 11:31 PM   PM User | #553
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by soofi View Post
Randall, my site www.videotomp3online.org was working fine but since last few days I'm getting this video error.. can you tell me what is wrong here

http://videotomp3online.org/error.jpg
Hi,

I tried to convert both a YouTube and Dailymotion video on your site, and I had no problems.

Also, just to be sure, I tested my software on my own installation of Ubuntu Linux, and, again, I had no problems converting both YouTube and Dailymotion videos.

What is the URL of the video that you are having problems converting?

Edit: Is this the video url: http://www.youtube.com/watch?v=PAytXoFZN58 ? When I try to access that video in YouTube, it says the video is blocked in my country. That would explain your error. There are some videos on YouTube that are blocked in certain countries, and some videos that are blocked in all countries except for one. There is very little a person can do to circumvent this.

To my knowledge, the best way around this issue is to use a proxy network like Tor -- and implement its command interface (in the PHP converter class file) to create a new, anonymous identity (IP address), which you can then use to access the blocked video (via cURL). I have done something like this before. The problems with this kind of solution are as follows:

1. Proxy networks are notoriously slow. So the downloads of your blocked videos will often be significantly slower, because you are stuck with the download speed of whatever proxy server you are using -- as well as any other relevant proxy server hardware/software specs. Speeds are also slower because proxy servers often cause the data to travel a longer and more complex path to its destination (than would otherwise be the case without a proxy server).

2. Tor, in particular, is an "anonymizing" service. It assigns you a random, anonymous id (ip address) from one of the nodes in its network. So the IP address you are given is not in any way guaranteed to come from a country that is not blocked by a given YouTube video. Subsequently, you have to keep generating new id's until you can find one that is from a country that is not blocked by the video. This process can further slow down the conversion of the video. (Note: Tor used to give you a way to exclude countries when generating new id's, but that feature is now deprecated, and no longer appears to function as expected.)

3. In any proxy network, you are confined to only the locations of the nodes in the network. So if a video is blocked in Canada, the U.S., and Mexico, for example, and all of the nodes in your proxy network are located in those 3 countries, then none of your proxy servers will be able to access and download the video either.

So, while a proxy network is the best solution to this problem (in my experience), it is not without its problems. But it can work most of the time for blocked videos if you don't mind the sometimes ridiculous amount of time it takes to download a video via proxy. And, chances are, a good percentage of your site users won't have patience for this.

As an aside, I have also explored VPN solutions like hidemyass.com's VPN service. The problem there is that the service only allows you to create a finite number of simultaneous VPN connections. So, let's say you have 100 people that are simultaneously converting blocked videos on your site. If you can only initiate 10 (for example) simultaneous VPN connections at any one time (via a service like hidemyass), then the other 90 people must wait to convert their videos. This issue could be addressed with a queuing system, but again you potentially have a lot of people waiting in line to convert videos (when you scale up the popularity of and traffic to your site). With proxy networks, you don't have this problem -- because there is really no significant limit to the number of simultaneous proxy connections you can make.

So, as you can see, it's a slippery slope to address the issue of blocked videos. While there are ways to address the issue, none of them are even close to providing an ideal or perfect solution. That said, if you need help addressing this issue, I can implement a proxy solution for you (as I have done it before). I would have to charge you my hourly rate to do this. Let me know if this interests you.


Edit: Forgot to mention that another way to deal with this issue is to carefully choose the location of your server. If you are able to use a server that is located in a country where relatively few videos are blocked, then that could potentially go a long way to addressing the problem. But, personally, I have no data or reference for you regarding which are the best countries to choose for this purpose. You would have to conduct your own research on this topic (if possible), and make your decision based on that research.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]

Last edited by chump2877; 11-24-2012 at 12:28 AM..
chump2877 is offline   Reply With Quote
Old 11-24-2012, 01:08 AM   PM User | #554
slaine
New Coder

 
Join Date: Nov 2012
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
slaine is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
I honestly have never heard of an issue like yours up until now. It sounds like you have an unconventional server setup, .
what is an unconventional server setup Now i have tried everything.

I did a clean install totally formated the disk and installed only the things in your setup file. As your guide is for Ubuntu

---my system-----
Ubuntu 12.04.1 LT

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Server version: Apache/2.2.22 (Ubuntu)

ffmpeg version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers.

Everything works perfect on 192.x remote it get stucked on converting part.

only error i can see in any log is
ob_flush(): failed to flush buffer. No buffer to flush
ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush

i put a @ before ob_end_flush(): ob_flush(): that filled up the access and error.log in /var/log/apache2 to 10 mb in zero time. but thats not the problem.

Give me a clue here mister chump. im not gonna use this for anything just want it to work.
slaine is offline   Reply With Quote
Old 11-24-2012, 01:36 AM   PM User | #555
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by slaine View Post
what is an unconventional server setup Now i have tried everything.

I did a clean install totally formated the disk and installed only the things in your setup file. As your guide is for Ubuntu

---my system-----
Ubuntu 12.04.1 LT

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Server version: Apache/2.2.22 (Ubuntu)

ffmpeg version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers.

Everything works perfect on 192.x remote it get stucked on converting part.

only error i can see in any log is
ob_flush(): failed to flush buffer. No buffer to flush
ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush

i put a @ before ob_end_flush(): ob_flush(): that filled up the access and error.log in /var/log/apache2 to 10 mb in zero time. but thats not the problem.

Give me a clue here mister chump. im not gonna use this for anything just want it to work.
Again, to use my software in a production environment, my recommendation to you is the following:

Quote:
I can only suggest trying to install my software on a professionally configured and/or commercially hosted server, and see if you have the same results.
There is sufficient documentation in the software files distribution and within this thread to successfully install the software. The only thing that isn't documented is the installation of the OS, which I assume people already know how to do, or it is already done for them.

Note: When installing my software, I recommend that you 'apt-get install' to get the stable versions of each package. I advise against building each (or any) of the packages from the git source.

Alternatively, you can download an Ubuntu VMware virtual machine here, and try to install inside a preconfigured VM. (for testing purposes?)

I can also install the software for you at my hourly rate.

Edit: You could also try installing in Ubuntu 11.10 instead of 12.04 to see if that has any effect. I suppose it is possible that 12.04 may require steps that are not required by 11.10. Just as different flavors of Linux require slightly different steps for the same installation. In the files distribution, I have included only one possible way to install my software. Installation steps may vary slightly in subsequent versions of Ubuntu, and will definitely vary across different Linux distributions. There are simply too many different Linux distributions (and versions within each distribution) for me to write installation guides for each and every one.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]

Last edited by chump2877; 11-24-2012 at 01:51 AM..
chump2877 is offline   Reply With Quote
Reply

Bookmarks

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

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 04:07 AM.


Advertisement
Log in to turn off these ads.