Jump to content

Need Help with simple_html_dom


gmcust3

Recommended Posts

I am using simple_html_dom.php

 

I am stuck with the Code of How to parse below Content :

<div id="entry_4" class="entry clearfix "><div class="entry_title clearfix"><h1 class=" ">Smith J</h1></div><div class="full_listing"><div class="blocks"><div id="entry_4_block_0" class="block indent-level-0"><div class="share_link" wpol:entryId="719183066N00W" wpol:contactPointId="719183066N00W"><div class="save_menu"><div class="icon"></div></div><div class="share_menu"><div class="icon"></div></div><a class="screen_reader_only" rel="nofollow"

href="/mobile/send-to-mobile-accessible?entryId=719183066N00W&listingId=719183066N00W&searchType=R&channel=WP"

name="Smith">Send this listing to your mobile</a></div><span class="phone_number ">0457 599 539</span>

<div class="address"><span class="street_line">1 Martin Pl</span><span class="locality">Sydney</span><span class="state">NSW</span><span class="postcode">2000</span></div><a rel="nofollow"

class="show_map"

name="Smith"

href="/search/where-is?locality=Sydney&streetNumber=1&streetName=Martin&streetType=Pl&state=NSW&product=N00W%23719183066N00W%23Smith+J&channel=WP"

onclick="return false;">Show map...</a></div></div></div></div>

 

I am trying

if(!$html->find('div[id=entry_' .$i.']',0)==""){ 
echo "inside0000"; 
foreach($html->find('div[id=entry_' .$i.']') as $result){ 
$resultdata[]=array( 
'name' => $result->find('h[class=" "]',0)->innertext, 
'streetLine' => $result->find('span[class=street_line]',0)->innertext, 
'locality' => $result->find('span[class=locality]',0)->innertext, 
'state' => $result->find('span[class=state]',0)->innertext, 
'postcode' => $result->find('span[class=postcode]',0)->innertext, 
'phone' => $result->find('span[phone_number ]',0)->innertext 
); 

 

 

It gets Into

 

inside0000

 

But doesn't Parse the Data.

 

Can anyone help me please ?

 

Link to comment
https://forums.phpfreaks.com/topic/223638-need-help-with-simple_html_dom/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.