Hi,
I am in need of doing an application actually a scraper, which does extracting contact details if exists in a given webpage. Means I need to pass a url to application, then application must find contact details by scraping and return all the matching records.
Emails, links, and contact forms, I was able to complete it.
But another important thing phone / fax numbers …
I think it is possible to do this using preg_match_all , but I do not understand how to prepare a regular expression for that.
As far as I know USA phone number format is as follows. Please correct me if wrong.
xxx xxx xxxx , xxx-xxx-xxxx , 1st digit should not be 1, it should be 2 to 9. As an international number 1-xxx-xxx-xxxx OR 1 xxx xxx xxxx …… I know some people may use brackets and some other characters, but think most of people place phone numbers in web pages in correct format…
So, assuming phone numbers in web pages are given in any of above formats, is it possible to extract them and store in an array using preg_match_all or any other…
If possible, could someone please let me know how to encode phone number formats into regular expressions..
Think since we have several possible phone numbers. several attempts per each may be need… May be someone have a genius regular expression to catch them all.
Thanks and Best Regards