//$cfg=array_rand($config,1); //echo $config[$cfg]; $config = array("a" => "credentials_us.conf", "b" => "credentials_us_f1.conf", "3" => "credentials_us_f2.conf", "4" => "credentials_us_f3.conf", "6" => "credentials_us_f5.conf", "ko" => "credentials_ko_mgscl29873.conf"); $cfg = array_rand($config, 1); if ($lang) { $cfg = $lang; } //$dl_cmd="python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d $id -f apkfiles -y -p -c credentials_us.conf"; $dl_cmd = "python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d {$id} -f /home/wwwroot/www.voteapps.com/apkfiles -y -p -c {$config[$cfg]}"; //echo $config[$cfg]; // echo $dl_cmd; //$dl_cmd="python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d $id -f apkfiles -y -p -c credentials_us.conf"; // $dl_cmd="python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d $id -f /home/wwwroot/www.voteapps.com/apkfiles -y -p -c $config[$cfg]"; // echo $dl_cmd; //print_r($return_var); $json = json_encode(dl_apk($id)); print $json; //json_encode(dl_apk($id)); //print_r($return_var); function dl_apk($id) { $config = array("a" => "credentials_us.conf", "b" => "credentials_us_f1.conf", "3" => "credentials_us_f2.conf", "4" => "credentials_us_f3.conf", "5" => "credentials_us_f4.conf", "6" => "credentials_us_f5.conf"); $cfg = array_rand($config, 1); //$dl_cmd="python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d $id -f apkfiles -y -p -c credentials_us.conf"; $dl_cmd = "python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d {$id} -f /home/wwwroot/www.voteapps.com/apkfiles -y -p -c {$config[$cfg]}"; //echo $dl_cmd; //$dl_480="youtube-dl -f $f -o $path_480 https://www.youtube.com/watch?v=$dl_url"; //执行下载 exec($dl_cmd, $output, $return_var); //print_r($output); //print_r($return_var);
<?php include_once "../drupal.php"; //include_once ("simple_html_dom.php"); //include_once ("libs/tags.php"); //include_once ("libs/postapp.php"); $id = "com.enlightouch.lungteng.sh"; //$_GET['id']="com.android.chrome"; $id = $_GET['id']; //./gplay-cli.py -d com.android.chrome -f apk -y -p -c credentials_us.conf //$dl_cmd="python gplay-cli.py -d $id -f apk -y -p -c credentials_us.conf"; //$dl_480="youtube-dl -f $f -o $path_480 https://www.youtube.com/watch?v=$dl_url"; //执行下载 //exec($dl_cmd, $output, $return_var); //print_r($output); //print_r($return_var); $fileUrl = dl_apk($id); print_r($fileUrl); //$apk=file_upload($fileUrl,$file_path="files"); print_r($apk); //echo "</br>开始上传视频..."; function file_upload($fileUrl, $file_path = "files") { //echo $file_path; // echo 's3://'.$fileUrl; $file_temp = file_get_contents('http://www.voteapps.com/' . $fileUrl); //print_r(); //Saves a file to the specified destination and creates a database entry. if (!file_exists($public_path . '/apkfiles')) { drupal_mkdir($public_path . '/apkfiles'); } $file_arry = file_save_data($file_temp, 's3://' . $fileUrl, FILE_EXISTS_REPLACE);