基本信息
源码名称:实现在线抓模板
源码大小:0.04M
文件格式:.rar
开发语言:PHP
更新时间:2014-07-06
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 4 元 
   源码介绍

利用php实现了网页模板抓取

参考网址:http://schoolbuy.net/gm/index.php

<?php
error_reporting(0);
/**
 * 读取文件
 * @param string $filename 路径
 * @param bool $isarray 为true则返回array
 * @return string/array
 */
function read($filename) {
    return file_exists($filename) ? include $filename : array();
}

/**
 * 写入文件
 * @param string $file 路径
 * @param string/array $content 为数组则以return array形式存放
 */
function write($file, $content) {
    if (is_array($content)) {
        $content = '<?php return ' . var_export($content, 1) . '?>';
    }
    
    file_put_contents($file, $content);
}
function rdv($start=0)
{
  $config = read($GLOBALS["cfg"]);
  return array_slice($config,intval($start));
}
function adv($value)
{

  $GLOBALS["array"][] = $value;
  write($GLOBALS["cfg"],$GLOBALS["array"]);
}
if(isset($_GET["url"]))
{
     $bu=urldecode($_GET["url"]);
     $inf=parse_url($bu);
     $GLOBALS["cfg"]=$inf["host"]."/config.php";
     if(isset($_GET['query']) && is_numeric($_GET['query']))
     {
        echo json_encode(rdv($_GET['query']));
        exit;
     }
    
}

?>