Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
244 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 34

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

604 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