Reply to Re: finding a specific area from page using regular expression

Your name:

Reply:


Posted by Hardik Dangar on 08/07/07 11:56

On Aug 6, 7:21 am, Kurt Milligan <kurt.milli...@gmail.com> wrote:
> On Aug 4, 12:23 pm, Hardik Dangar <hardikdan...@gmail.com> wrote:
> [snip]
>
>
>
> > 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 ?
>
> This should do what you want (retrieving the email and URL):
>
> $matches = array();
>
> preg_match('/<a href=[\'"]?mailto:([^>\'"\s]+).*<a href=[\'"]?([^>
> \'"\s]+)/s',$yourPageContents,$matches);
>
> print "email: $matches[1], url: $matches[2]";
>
> HTH
> -Kurt
thank you everyone i m almost at end of work but new problem... :(
i've try to use dom functions and it did work fine at my home but once
i try at server it give me error

domdocument() expects at least 1 parameter, 0 given in /home/sphere/
public_html/hardik/curl/temp2.php on line 2


here is my code,


$doc = new DOMDocument();
$doc->loadHTML($str);

can anyone suggest me what is the problem

[Back to original 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

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