|
Posted by Kurt Milligan on 08/06/07 02:21
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
[Back to original message]
|