2

我正在尝试使用 Coldfusion 中的以下代码筛选另一个应用程序。

 <cfhttp url="https://intra.att.com/itscmetrics/EM2/LTMR.cfm" method="get" username="uvwxyz" password="abcdef">  

 <cfhttpparam type="url" name="LTMX" value="Andre Fuetsch / Shelly K Lazzaro">

</cfhttp> 

  <cfset myDocument = cfhttp.fileContent>

<cfoutput>
  #myDocument#
</cfoutput>

现在,当我运行我的 cfm 页面时,我可以使用上面的代码访问目标页面。目标页面如下所示。

在此处输入图像描述

部分源代码如下。

<table border="1" width=99% style="border-collapse:collapse;">
    <thead>
    <td colspan="12" class="drpmainheader1_2">LTM Detail Report for Andre Fuetsch / Shelly K Lazzaro</td>
    <tr align="center">
      <th class="ptitles">Liaison Name</th>
      <th class="ptitles">Application Acronym</th>
      <th class="ptitles">MOTS ID</th>
      <th class="ptitles">Priority</th> 
      <th class="ptitles">MC</th>
      <th class="ptitles">DR Exercise</th>
      <th class="ptitles">ARM/SRM Maintenance</th>
      <th class="ptitles">ARM/SRM Creation</th>             
      <th class="ptitles">Backup & Recovery Certification</th>
      <th class="ptitles">Interface Certification</th>
      <th class="ptitles">AIA Compliance</th>   
    </tr>
    </thead>

    <tbody>
    <tr>
    <td class="drpdetailtablerowdetailleft">Lynette M Acosta</td>
    <td class="drpdetailtablerowdetailleft">AABA</td>
    <td class="drpdetailtablerowdetail"><a href="http://ebiz.sbc.com/mots/detail.cfm?appl_id=9710" target="_blank" style="color:blue;">9710</a></td>
    <td class="drpdetailtablerowdetail">5</td>
    <td class="drpdetailtablerowdetail">NMC</td>
<td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td>
    </tr>
    </tbody>

    <tbody>
    <tr>
    <td class="drpdetailtablerowdetailleft">Lynette M Acosta</td>
    <td class="drpdetailtablerowdetailleft">ABS RECON+</td>
    <td class="drpdetailtablerowdetail"><a href="http://ebiz.sbc.com/mots/detail.cfm?appl_id=13999" target="_blank" style="color:blue;">13999</a></td>
    <td class="drpdetailtablerowdetail">3</td>
    <td class="drpdetailtablerowdetail">NMC</td>
<td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td> <td class="drpdetailtablerowdetail">Compliant</td>
    </tr>
    </tbody>

我不擅长coldfusion中的正则表达式,谁能指导我或给我任何关于如何使用Coldfusion从html表中提取数据的起点?我无权访问数据库。希望这很清楚。

4

1 回答 1

4

使用正则表达式解析 HTML?如果您使用带有 ColdFusion 的 jsoup HTML Parser,您将有更多选择。Jsoup 使用类似 jQuery 的 DOM 选择器,可以快速将 HTML 表格数据转换为数组。

http://jsoup.org/

以下是一些相关文章和示例代码:

于 2014-03-26T18:17:03.163 回答