示例#1
0
function processUrl($url)
{
    return "http://www.kegg.jp" . $url;
}
function processTitle($title)
{
    return str_replace(array("</a>&nbsp;", "\">"), "", $title);
}
if (isset($_GET['id'])) {
    $param = trim($_GET['id']);
    $id = str_split($param, 2);
    foreach ($id as $k => $v) {
        $id_arr[] = intval($v);
    }
    $ko_arr = getMetaKOByIdArr($id_arr);
    $url = getModuleUrl($ko_arr);
    $content = file_get_contents($url);
    $flag = 0;
    $preg = "\\/kegg-bin\\/(.*)\\.args/i";
    $preg_url = "/\\/kegg-bin\\/(.*)\\.args/i";
    $preg_title = "/\">M(.*)<\\/a>&nbsp;/i";
    if (!preg_match_all($preg_url, $content, $url_list)) {
        $flag = 1;
    }
    if (!preg_match_all($preg_title, $content, $title_list)) {
        $flag = 2;
    }
} else {
    die;
}
?>
{
    return "http://www.kegg.jp" . $url;
}
function processTitle($title)
{
    return str_replace(array("</a>&nbsp;", "\">"), "", $title);
}
if (isset($_GET['id'])) {
    $param = trim($_GET['id']);
    $id = str_split($param, 2);
    $idArr = array();
    foreach ($id as $k => $v) {
        array_push($idArr, intval($v));
    }
    $koArr = getKOByIdArr($idArr);
    $url = getModuleUrl($koArr);
    $content = file_get_contents($url);
    $flag = 0;
    $preg = "\\/kegg-bin\\/(.*)\\.args/i";
    $pregUrl = "/\\/kegg-bin\\/(.*)\\.args/i";
    $pregTitle = "/\">M(.*)<\\/a>&nbsp;/i";
    if (!preg_match_all($pregUrl, $content, $urlList)) {
        $flag = 1;
    }
    if (!preg_match_all($pregTitle, $content, $titleList)) {
        $flag = 2;
    }
} else {
    echo 'An error has occurred in parameter.';
    die;
}