从HTML页面php中刮取数据 [英] scrape the data from html page php

查看:86
本文介绍了从HTML页面php中刮取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从HTML页面中刮取数据

I need to scrape the data from an html page

<div style="margin-top: 0px; padding-right: 5px;" class="lftFlt1">

    <a href="" onclick="setList1(157204);return false;" class="contentSubHead" title="USA USA">USA USA</a>
    <div style="display: inline; margin-right: 10px;"><a href="" onclick="rate('157204');return false;"><img src="http://icdn.raaga.com/3_s.gif" title="RATING: 3.29" style="position: relative; left: 5px;" height="10" width="60" border="0"></a></div>
    </div>

我需要刮掉美国美国 157204 onclick =setList1 ...

I need to scrape the "USA USA" and 157204 from the onclick="setList1...

推荐答案

您应该使用 DOMDocument XPath 。通常不建议使用RegEx解析HTML。

You should use DOMDocument or XPath. RegEx is generally not recommended for parsing HTML.

这篇关于从HTML页面php中刮取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆