通过PHP调用vbs脚本 启动迅雷下载软件. 单独运行vbs迅雷可以下载 PHP调用 没反应?
php代码如下:
<?php 
define('ROOT', dirname(__FILE__).'/');
define('vbs', ROOT.'cmccapp_down.vbs');
$rs = array();
$file = 'http://www.baidu.com/img/baidu_sylogo1.gif';
if(!is_file($file)){
$name = basename($file);
$rs = array($file, $name, 'http://www.cmccapp.com/');
$content = file_get_contents(vbs);
preg_match_all('#\"([^"]+)\",#', $content, $m);
foreach($m[1] as $key=>$val){
$content = str_replace($val, $rs[$key], $content);
}
file_put_contents(vbs, $content);
$WshShell = new COM("WScript.Shell"); $cmdline = "cmd /C ".vbs;
$oExec = $WshShell -> Run($cmdline, 0, false); 
}
?>
vbs代码如下:Set ThunderAgent = CreateObject("ThunderAgent.Agent.1") 
Call ThunderAgent.AddTask("http://www.baidu.com/img/baidu_sylogo1.gif","baidu_sylogo1.gif","","","http://www.cmccapp.com/",1,0,5) 
Call ThunderAgent.CommitTasks2(1) 
Set ThunderAgent = Nothing