View Single Post
Old 10-06-2012, 06:30 PM   PM User | #497
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
Can you help me please to make my script work?

I created additional Class with function inside - Second.class.php.
Then I add in the beginning of index.php:

PHP Code:
// Instantiate second class
    
include 'Second.class.php';
    
$secondclass = new Second(); 
Then I need to call a function out of the class, but with following conditions:
1. It can be called only when mp3 file is already decoded and placed in mp3 folder.
2. It has parameter $filename, where the $filename is obviously the name of the file (like 'Beatles_-_Let_it_be.mp3')

I tried to add it in the end:
PHP Code:
$converter->GenerateMP3($_POST['quality']);
    
$secondclass->myfunction(strstr($converter->GetSongFileName())); 
As I thought that's how I can get filename.

And the function looks like this:
PHP Code:
function myfunction($filename)
        {
            
$filepath =  $_SERVER['PHP_SELF'].parent::_SONGFILEDIR.$filename;
            
$ch curl_init();
            
curl_setopt_array($ch, array(
            
CURLOPT_RETURNTRANSFER => 1,
            
CURLOPT_URL => parent::_APIURL,
            
CURLOPT_POST => TRUE,
            
CURLOPT_POSTFIELDS => 'api_key='.parent::_APIKEY.'&url='.$filepath,
            ));
            
            
$output curl_exec($ch);
            
curl_close($ch); 
Could you tell me what could be wrong with that?
dareweb is offline   Reply With Quote