Solved

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

Posted on 2011-09-15
5
195 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
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 32

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
 
LVL 82

Expert Comment

by:leakim971
ID: 36544595
0
 

Author Comment

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

Accepted Solution

by:
Ray Paseur earned 500 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now