Quote Originally Posted by soft2050 View Post
Execute this:

PHP Code: 
//***Check whether torrents are complete***
                
$check true;
                while (
$check) {
                    
$c 0;
                    foreach (
$id as $value) {
                        
$result callTransmission(array("fields" =>  array("id""name""percentDone"), "ids" => array($value)),  "torrent-get"$arr[1]);
print_r($result); exit;
                        
preg_match('/"percentDone":[0-9.]+/i'$result[0], $matches);
                        
$adii substr($matches[0], 14);
                        
$anuj = (int) ($adii 100);
                        
update_progress($anuj); //CALL FUNCTION
                        
$anujstatus "Download In Progress";
                        
$downcomplete "Download Finished";
                        
anujstatus($anujstatus);
                        if (
$anuj=='100') {
                            
aditya(100);
                            
anujstatus($downcomplete);
                            echo 
"<br><br><br><br> Download complete";
                            break 
2;
                        }
                        if (
$matches[0] == '"percentDone":1.0000')
                            
$c++;
                    }


                    if (
$c==count($id)) {
                        
$check false;
                        break 
2;
                    }
                    
sleep(5);
                } 
and let us know output

updated with print_r, soft2050


Notice: Undefined variable: temp in /var/www/html/donofwarez/xxx/torrents/bgrahul.php on line 338
Array ( [0] => HTTP/1.1 200 OK Server: Transmission Content-Type: application/json; charset=UTF-8 Date: Wed, 21 Sep 2011 18:29:58 GMT Content-Length: 49 {"arguments":{"torrents":[]},"result":"success"} [1] => )


//######TORRENT DOWNLOAD START########
$filename = "/var/www/html/donofwarez/xxx/database/downloads/$title.txt";

if (file_exists($filename)) {

$source = "/var/www/html/donofwarez/xxx/database/downloads/$title.txt";
$downloaded = file_get_contents($source);
$downloaded = trim($downloaded);
$startdownload = '';

if ($downloaded =='Yes') {
echo "Already downloaded......";
} else {
$startdownload = "true";
}
} else {
$startdownload = "true";
}
echo $startdownload;
if ($startdownload =="true") {
echo "<br><br><br> Starting download: $title";
$id = array();


$result = callTransmission(array("filename" => "/var/www/html/donofwarez/xxx/torrents/$torrentfile", "download-dir" => "/home/Downloads/$title/"), "torrent-add", $arr[1]);
callTransmission(array("seedRatioLimit" => 50, "seedRatioMode" => 1), "torrent-set", $arr[1]);
/*
echo "<pre>";
print_r($result);
echo "</pre>";
*/
if (preg_match('/"percentDone":[0-9.]+/i', $result[0], $matches))
$temp = str_replace('"id":', "", $matches[0]);
// $temp="hlDr1wqu2ONtM3McVGHoVzfrkp2UgUcGwDt66IuxAe0 LBkru";
$id[0] = $temp;
//***OMG! We need the ids as integers! ***
foreach ($id as $key => $value) {
$id[$key] = (int) $value;
}
//***Check whether torrents are complete***
$check = true;
while ($check) {
$c = 0;
foreach ($id as $value) {
$result = callTransmission(array("fields" => array("id", "name", "percentDone"), "ids" => array($value)), "torrent-get", $arr[1]);
preg_match('/"percentDone":[0-9.]+/i', $result[0], $matches);
$adii = substr($matches[0], 14);
$anuj = (int) ($adii * 100);
update_progress($anuj); //CALL FUNCTION
$anujstatus = "Download In Progress";
$downcomplete = "Download Finished";
anujstatus($anujstatus);
if ($anuj=='100') {
aditya(100);
anujstatus($downcomplete);
echo "<br><br><br><br> Download complete";
break 2;
}
if ($matches[0] == '"percentDone":1.0000')
$c++;
}


if ($c==count($id)) {
$check = false;
break 2;
}
sleep(5);
}