coldfusion - 使用 Coldfusion 进行屏幕抓取

标签 coldfusion screen-scraping cfhttp

我正在尝试在 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 页面时,我可以使用上述代码访问目标页面。 目标页面如下所示。

enter image description here

其部分源代码如下。

<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 表中提取数据的起点吗?我无权访问数据库。希望这一点是清楚的。

最佳答案

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

http://jsoup.org/

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

关于coldfusion - 使用 Coldfusion 进行屏幕抓取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22668870/

相关文章:

javascript - 使用 JavaScript 或 Coldfusion 根据 4 或 5 个坐标点绘制和填充区域

coldfusion - cffile action ="rename"=== fileMove 在 CFScript 中吗?

java - FTP - 以编程方式确定剩余时间或传输的字节数的方法?

c# - HTML 页面抓取

python - 如何 scrapy 处理 dns 查找失败

rest - CFHTTP HTTPS 连接失败 CF8

php - 使用 CFHTTP 将 HTML 表单数组提交给 PHP

sql-server - 在 Coldfusion 中使用 nvarchar cfsqltype 和 jtds jdbc

python-2.7 - Scrapy Crawl Spider 不跟踪链接

soap - Coldfusion CFHTTP 握手失败