开发者

jQuery filtering and traversing (phpQuery)

开发者 https://www.devze.com 2022-12-18 21:47 出处:网络
I am trying to parse data off a page using phpquery(almost same as jquery), I need code to get these 2 things,

I am trying to parse data off a page using phpquery(almost same as jquery),

I need code to get these 2 things,

B K Guda Association Hall

and

Main Road, C Type Colony, B K Guda

other things can be left out..

this is the html

<td> 
<a href="#...">
    <span class="a12bl">
        <u>
            <h2 class="bold">B K Guda Association Hall</h2>
        </u>
    </span>
</a>
Main Road, C Type Colony, B K Guda          <br>



            <!--filter this out...-->

            <div style="float: left;" id="42918save"> 
<a href="http://www.fullhyderabad.com/profile/locations/42918/1#tabs"><u>Rate</u></a> • <a href="javascript:save开发者_如何学Gosubmit('form42918','results42918','','locations',%20'42918')"><u>Save</u></a> • <a href="http://www.fullhyderabad.com/profile/locations/42918/4"><u>Map</u></a>          <div style="clear: both;"></div>
            </div>
            <!--AJAX MAIN DIV END-->
            <form style="margin: 0px;" name="deleteform42918">
                <input type="hidden" value="42918" name="eventid">
                <input type="hidden" value="delete" name="edittype">
            </form>
            <form style="margin: 0px;" name="form42918">
                <input type="hidden" value="42918" name="eventid">
                <input type="hidden" value="update" name="edittype">
            </form>

            <div style="clear: both;"></div>
            <div id="results42918">
                        </div>
</td>


How about:

pq('div')->remove();
pq('form')->remove();
$text1 = pq('a')->text();
pq('a').remove();
$text2 = pq('td').text();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号