-3

I would like someone to point me in the right direction for my issue. I want to know if php or javascript can scan other websites for phone numbers, maybe (<a href=+1 123-123-1234). then pass it back to your web application if they click on the number to be able to call.. (get post) type of function? Examples are welcomed

thank you

coco minion
  • 123
  • 2
  • 15

2 Answers2

2

Your issue requires attention in two sections

  1. PHP scraper where you will give the list of urls and scrape them once or on a routine basis. For this feature, Goutte is your best friend. Read a quick how-to guide and you will be good to go

  2. In order to extract phone numbers from the web pages you will need to regex to detect phone numbers. Have a look @ this stackover issue to put you in a right direction

Hope the above helps, let us know if you come across any further problem

usman zafar
  • 220
  • 2
  • 9
1

js is answered here : Can Javascript read the source of any web page?

then indeed, you might have to use regex...

sample from the answer as it is today :

Simple way to start, try jQuery

$("#links").load("/Main_Page #jq-p-Getting-Started li");

More at jQuery Docs

Another way to do screen scraping in a much more structured way is to use YQL or Yahoo Query Language. It will return the scraped data structured as JSON or xml. e.g. Let's scrape stackoverflow.com

select * from html where url="http://stackoverflow.com"

will give you a JSON array...

Community
  • 1
  • 1
singe batteur
  • 401
  • 2
  • 14