public function pinyin()
 {
     die;
     set_time_limit(200);
     $PinyinList = I('pinyins');
     $UrlList = I('urls');
     foreach ($PinyinList as $k => $v) {
         $Name = trim(str_replace('\\n', '', $v));
         $IsExist = M('pinyin')->where(array('pinyin' => $Name))->select();
         if (!$IsExist) {
             M('pinyin')->add(array('name' => '', 'pinyin' => $Name, 'code' => ''));
         }
         if (!file_exists(ROOT_PATH . $UrlList[$k])) {
             MakeHtml(ROOT_PATH . $UrlList[$k], 'http://xh.5156edu.com/' . $UrlList[$k], null);
         }
     }
 }
 public function index()
 {
     MakeHtml(ROOT_PATH . '/News/264.html', 'http://localhost/duoyiren/company/index.php?id=2477', '');
     die;
     $this->display("newsList");
 }
Ejemplo n.º 3
0
function ShowHtml()
{
    global $htmlw, $page, $mode;
    if (!$htmlw || $page || $mode == 'resmsg') {
        head($buf);
        Main($buf);
        foot($buf);
        echo $buf;
    } else {
        if (!is_file(HTML_FILE)) {
            MakeHtml();
        }
        $html_file = file_exists('mod_gzip.php') ? "mod_gzip.php?" . HTML_FILE : HTML_FILE;
        echo '<META HTTP-EQUIV="refresh" content="0;URL=' . $html_file . '?' . microtime() . '">';
        #header("Location: $html_file?");
    }
}
 public function get()
 {
     ob_end_clean();
     header("Content-Type:text/html;charset=utf8;");
     ob_start();
     set_time_limit(500);
     $Min = I('min');
     $Max = I('max');
     if (is_numeric($Min) && is_numeric($Max) && $Min <= $Max) {
         //http://match.sports.sina.com.cn/football/team_iframe.php?id=4418&year=2008
         //http://liansai.500.com/index.php?c=teams&a=ajax_fixture&records=100&tid=864&hoa=0
         for ($i = $Min; $i <= $Max; $i++) {
             if (!file_exists(ROOT_PATH . '/Football/' . $i . '.html')) {
                 echo '<script>parent.PostReturnCallback(\'' . '正在获取!' . $i . '\');</script>';
                 ob_flush();
                 flush();
                 ob_end_flush();
                 MakeHtml(ROOT_PATH . '/Football/' . $i . '.html', 'http://liansai.500.com/index.php?c=teams&a=ajax_fixture&records=100&tid=' . $i . '&hoa=0', '');
             }
         }
         $OutputInfo = json_encode(array('msg' => '获取成功,操作结束!' . $i, 'url' => U('Football/Index/Index'), 'autoClose' => '1', 'type' => '1'));
         echo '<script>parent.PostReturnIframeCallback(\'' . $OutputInfo . '\');</script>';
         die;
         //echo '获取成功!';
     } else {
         $OutputInfo = json_encode(array('msg' => '参数不正确!' . $i, 'url' => U('Football/Index/Index'), 'autoClose' => '1', 'type' => '1'));
         echo '<script>parent.PostReturnIframeCallback(\'' . $OutputInfo . '\');</script>';
         die;
         //echo '参数不正确!';
     }
 }
Ejemplo n.º 5
0
/**
 * Summary of MakeHtml
 * @param mixed $htmlFilePath 
 * @param mixed $htmlUrl 
 * @param mixed $htmlDirectory 
 * @return mixed
 */
function MakeHtml($htmlFilePath = null, $htmlUrl = null, $htmlDirectory = null)
{
    $dirarray = explode('.', $htmlFilePath);
    if (end($dirarray) != 'html') {
        //$this->ACT_layer_msg( "非法文件名!",8,$_SERVER['HTTP_REFERER'],2,1);
        return array('errorCode' => '1', 'type' => '0', 'msg' => '非法文件名!', 'url' => $_SERVER['HTTP_REFERER']);
        exit;
    }
    $dirarr = @explode("/", $htmlFilePath);
    if (is_array($dirarr)) {
        foreach ($dirarr as $v) {
            if (!strstr($v, ".html")) {
                $dir2 .= $v . "/";
                MakeDirectory($dir2);
            }
        }
    }
    $fp = @fopen($htmlFilePath, "w+");
    if (function_exists('file_get_contents')) {
        $content = file_get_contents($htmlUrl);
    } else {
        if (function_exists('curl_init')) {
            $ch = curl_init();
            $timeout = 5;
            curl_setopt($ch, CURLOPT_URL, $htmlUrl);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            $content = curl_exec($ch);
            if (!$content || !strlen($content)) {
                sleep(5);
                MakeHtml($htmlFilePath, $htmlUrl, $htmlDirectory);
            }
            curl_close($ch);
        } else {
            //$this->get_admin_msg($_SERVER['HTTP_REFERER'],"请开启CURL模块或者file_get_contents函数");
            return array('errorCode' => '2', 'type' => '0', 'type' => '0', 'msg' => '请开启CURL模块或者file_get_contents函数', 'url' => $_SERVER['HTTP_REFERER']);
        }
    }
    $fw = @fwrite($fp, $content);
    @fclose($fp);
    return $fw;
}
 public function getdata()
 {
     ob_end_clean();
     header("Content-Type:text/html;charset=utf8;");
     ob_start();
     set_time_limit(5000);
     $Min = I('min');
     $Max = I('max');
     if (is_numeric($Min) && is_numeric($Max) && $Min <= $Max) {
         $SrockList = M('stock')->select();
         foreach ($SrockList as $v) {
             if (!file_exists(ROOT_PATH . '/Stock/data/' . $v['symbol'] . '.html')) {
                 echo '<script>parent.PostReturnCallback(\'' . '正在获取!' . $v['symbol'] . '\');</script>';
                 ob_flush();
                 flush();
                 ob_end_flush();
                 $StockCode = substr($v['symbol'], 2);
                 MakeHtml(ROOT_PATH . '/Stock/data/' . $v['symbol'] . '.html', 'http://img1.money.126.net/data/hs/time/4days/0' . $StockCode . '.json?callback=ne3de23ad4bdf098', '');
             }
         }
         $OutputInfo = json_encode(array('msg' => '获取成功,操作结束!' . $i, 'url' => U('Stock/Index/Index'), 'autoClose' => '1', 'type' => '1'));
         echo '<script>parent.PostReturnIframeCallback(\'' . $OutputInfo . '\');</script>';
         die;
         //echo '获取成功!';
     } else {
         $OutputInfo = json_encode(array('msg' => '参数不正确!' . $i, 'url' => U('Stock/Index/Index'), 'autoClose' => '1', 'type' => '1'));
         echo '<script>parent.PostReturnIframeCallback(\'' . $OutputInfo . '\');</script>';
         die;
         //echo '参数不正确!';
     }
 }