阅读html url并在php中解析

时间:2014-05-13 09:27:51

标签: php html json html-parsing

我的html代码如下:

<html>
......
<div.....>

<div..>
    <ul class="class1">
        <li><div class="class2"><a href="link1">text1</a>...</div><li>
        <li><div class="class2"><a href="link2">text2</a>...</div><li>
        <li><div class="class2"><a href="link3">text3</a>...</div><li><li>
        <div class="class2"><a href="link4">text4</a>...</div><li>
    </ul>
</div>

<div class="n">
    <a href="nextlink">Next Page »</a>
</div>
</div>
.....
</html>

我需要从这个html()生成一个json。

{"headings":[{"name":"text1","value":"link1"},{"name":"text2","value":"link2"},
{"name":"text3","value":"link3"}{"name":"text4","value":"link4"}],"nextpage":"nextlink"}

0 个答案:

没有答案