将HTML转换为json,形式为抓取php

时间:2015-02-26 10:40:06

标签: php json web-scraping

这个html结构来自其他一些网址,我们需要使用文件获取内容或使用curl提取

enter image description here

The <div> structure shown above in the image.
What i want to do is convert this <div> structure into a json encode structure.
But in json array structure it should look like.
partition need to be made based on <h2> tag followed by their <div> tags.
eg: if first <h2> tag containes one <div> tag then <h2> tag array must contain only one sub array of <div> tag.
if <h2> tag followed by three <div> tag then <h2> tag array must contain three sub array of <div> tags.

0 个答案:

没有答案