<?php require_once '../apps/conf_ini.php'; $oParser = new HtmlParse(); // アクセスする URL を指定 $URL = 'http://perldoc.jp/docs/modules/DBD-mysql-2.1026/DBD/mysql/INSTALL.pod'; $sHtml = getHtmlData($URL); //UTF-8にエンコード $enc = mb_detect_encoding($sHtml); $sHtml = mb_convert_encoding($sHtml, "UTF-8", $enc); //解析 $rtn = $oParser->execHtmlParse($sHtml); if ($rtn !== false) { list($aSubject, $aUrl, $aNonTagHtml) = $rtn; $fp = fopen("C:/body.txt", 'w'); $sLine = implode('', $aNonTagHtml); fwrite($fp, mb_convert_encoding($sLine, "SJIS", "UTF-8")); $flag = fclose($fp); }
<?php require_once '../apps/conf_ini.php'; require_once 'apps/class/Process/CollectHtml/CollectHtmlDao_cls.php'; // 初期化 $oDb = new CollectHtmlDao($oDbConnMng); // HTML取得先URLリスト取得 $aUrlHeader = $oDb->getUrl(); while ($aUrlHeader && count($aUrlHeader) != 0) { $aHtml = array(); $aOkUrlId = array(); $aErrUrlId = array(); for ($iCnt = 0; $iCnt < count($aUrlHeader); $iCnt++) { // アクセスする URL を指定 echo $aUrlHeader[$iCnt]['url'] . "\n"; $sHtml = getHtmlData($aUrlHeader[$iCnt]['url']); if (!$sHtml) { $aErrUrlId[] = $aUrlHeader[$iCnt]['url_id']; continue; } // UTF-8にエンコード $enc = mb_detect_encoding($sHtml); $sHtml = mb_convert_encoding($sHtml, "UTF-8", $enc); // $aHtml[] = array('url_id' => $aUrlHeader[$iCnt]['url_id'], 'html' => $sHtml); $aOkUrlId[] = $aUrlHeader[$iCnt]['url_id']; } $oDb->setHtml($aHtml); $oDb->updateUrlStatus($aOkUrlId, URL_STATUS_END); if (count($aErrUrlId) != 0) { $oDb->updateUrlStatus($aErrUrlId, URL_STATUS_FAILED);
$add_data_arr['meeting'] = $meeting; $add_data_arr['fuelcharge'] = $fuelcharge; $add_data_arr['airport'] = $airport; $add_data_arr['insurance'] = $insurance; $add_data_arr['passportvisa'] = $passportvisa; $file_path = $baseDir."board/boardSkin/s_nowcroatia/"; $schedule = '<TABLE cellSpacing=0 cellPadding=0 width=780 border=0>'; $schedule .= '<TBODY><TR><TD><IMG '; $schedule .= 'src="/board/boardSkin/s_nowcroatia/images/view/head_sch.gif"'; $schedule .= 'width=780 height=31></TD></TR></TBODY></TABLE>'; for($i=1; $i<=$days; $i++) $schedule .= getHtmlData($file_path."schedule.htm"); $check_point = getHtmlData($file_path."check_point.htm"); $add_data_arr['schedule'] = $schedule; $add_data_arr['check_point'] = $check_point; $board_control->update_add_data($insertId, $add_data_arr, $title_en); } elseif($boardSetting['template'] == 'event') { $add_data_arr['start_date'] = $start_date; $add_data_arr['end_date'] = $end_date; $board_control->update_add_data($insertId, $add_data_arr, $title_en); } elseif($boardSetting['template'] == 'calendar') {