?
Solved

Is there a script I can run that will pull phone numbers and emails from a website?

Posted on 2011-09-15
5
Medium Priority
?
240 Views
Last Modified: 2012-05-12
I am creating a list of phone numbers and emails from this site: http://www.golfnationwide.com/US-Golf-Course-List-And-Directory.aspx.  Is there a script I can run that would essentially crawl this site and return all of the email and phone numbers?
0
Comment
Question by:tprofits
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36544364
Not really...
If you've some $$$ go on one of the following site :
https://www.odesk.com/
http://www.rent-acoder.com/
http://www.freelancer.com/
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 36544524
if you're interested in hiring someone to do the work, I'd be willing to offer my services. I'll charge less as I'm trying to build up my portfolio.
0
 

Author Comment

by:tprofits
ID: 36544836
The_Big_Daddy - Contact me at tjback@gmail.com.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 36549135
You will need a list of all the golf clubs.  They are listed by state.  So you will first want to scrape this page:
http://www.golfnationwide.com/Default.aspx

Then for each state, you will find a list that looks like this.  You will need to collect the URLS for each of the club links.
http://www.golfnationwide.com/Golf-Courses-By-State/Virginia-Golf-Courses__VA.aspx

Once you have those URLs, they will point to pages like this:
http://www.golfnationwide.com/Golf-Courses-By-State/Virginia/Belle-Haven-Country-Club___32739.aspx

The code snippet shows how to isolate the information you want for each of the clubs.

Best of luck with your project, ~Ray
<?php // RAY_temp_tprofits.php
error_reporting(E_ALL);


// ONE OF THE PAGES TO SEARCH
$url = 'http://www.golfnationwide.com/Golf-Courses-By-State/Virginia/Belle-Haven-Country-Club___32739.aspx';
$htm = file_get_contents($url);

// THE THINGS WE DO NOT NEED
$junk = array
( '<span id="Block">'
, '<span id="CourseImage">'
)
;

// THE THINGS WE WANT TO FIND
$things = array
( 'ctl00_MainContentPlaceholder_CourseNameLabel' => 'NAME:  '
, 'ctl00_MainContentPlaceholder_EmailLabel'      => 'EMAIL: '
, 'ctl00_MainContentPlaceholder_PhoneLabel'      => 'PHONE: '
)
;

// AVOID SEARCHING THROUGH ALL THE NOISE
$arr = explode($junk[0], $htm);
$arr = explode($junk[1], $arr[1]);
$htm = $arr[0];

// SEARCH THE STRINGS
foreach ($things as $target => $thing)
{
    // CONSTRUCT A REGULAR EXPRESSION
    $regex
    = '#'        // REGEX DELIMITER
    . '\<span'   // OPEN-SPAN TAG
    . '.*?'      // ANYTHING OR NOTHING
    . $target    // THE SEARCH STRING
    . '.*?'      // ANYTHING OR NOTHING
    . '\>'       // END OF THE OPEN-SPAN TAG
    . '(.*?)'    // GROUP OF CHARACTERS
    . '\</span'  // CLOSE-SPAN TAG
    . '#'        // REGEX DELIMITER
    . 'i'        // CASE-INSENSITIVE
    ;

    // SEARCH THE HTML FRAGMENT
    preg_match($regex, $htm, $mat);
    $new[$thing] = $mat[1];
}

// SHOW THE WORK PRODUCT
echo "<pre>";
print_r($new);

Open in new window

0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question