You are here: Re: finding a specific area from page using regular expression « PHP Programming Language « IT news, forums, messages
Re: finding a specific area from page using regular expression

Posted by Neil on 08/05/07 19:25

On Aug 4, 11:34 am, Hardik Dangar <hardikdan...@gmail.com> wrote:
> On Aug 4, 11:16 pm, "Paul Lautman" <paul.laut...@btinternet.com>
> wrote:
>
>
>
> > Hardik Dangar wrote:
> > > On Aug 4, 10:26 pm, "Paul Lautman" <paul.laut...@btinternet.com>
> > > wrote:
> > >> Hardik Dangar wrote:
> > >>> hi friends,
> > >>> i have a bunch of html pages and i want to fetch records from them
> > >>> and i m really confused how i can do after working with regular
> > >>> expressions and other stuffs from last few days can anyone help me
> > >>> with this ?
>
> > >>> i have a pages with html and table all scatter there..now i want
> > >>> just specific table from the page and all records in that page, i
> > >>> was successfull somehow but still have problems ,here are they..
>
> > >>> my example page...(just a table it has all the tags like html but i
> > >>> didnt write here just the thing i want is here)
>
> > >>> <table>
> > >>> <tr>
> > >>> <img src=..">
> > >>> </tr>
> > >>> <tr>
> > >>> <table>
> > >>> <tr>
> > >>> <tr>
> > >>> <td>
> > >>> <b>name1</B>
> > >>> <br>
> > >>> <font size=2 color=darkgray ><i>address1</i></font><br>
> > >>> <br>phone no
> > >>>> <a href=mailto:m...@gmail.com>E-mail1 </a>
> > >>>> <a href='www.website.com'target=_blank>website1</a>
> > >>> </font>
> > >>> </td>
> > >>> </tr>
> > >>> </tr>
> > >>> <tr>
> > >>> <b> name2</b>
> > >>> .........
> > >>> </tr>
> > >>> </table>
> > >>> </tr>
> > >>> </table>
>
> > >>> now from that table i want name,address,phone no,email,website..
> > >>> using preg_replace function i was able to find all those things but
> > >>> it removes <A> tag so email and website are also removed...can
> > >>> anyone tell me how i can find email and website first from that
> > >>> code and then using preg_replace i can get other records...or else
> > >>> can anyone tell me any better solution like currently by using
> > >>> while loop and using if condition i m breaking at the main table
> > >>> and then fetching each record but any better solution ?
>
> > >> Check out the DOM functions:http://uk.php.net/manual/en/ref.dom.php
>
> > > @paul
> > > thanx for the help but,
> > > can you explain me how i can use it ?
> > > i didnt get i guess its for working with xml
> > > how can i use with my problem ?
>
> > As long as your HTML is "well formed", you can use the DOM functions to
> > process it.
>
> @paul
> i have seen the documentation again and i find loadhtmlfile but steel
> i m very much confused how i can get my table data from webpage using
> those functions ? if you know anything then plz plz just give me
> simple example i m reading this dom thing again and again and getting
> interested in it...
> thank you very much for helping

Use the XPath functionality of the DOM Functions to extract the tags
you need.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация