I am looking for a job. And I am working on a script that will cron once a day. It is pulling text and links from a website. I am helpless when it comes to regex patterns.
Here is an example of what data I am pulling from:
<div class="cat-list-item job-list-item">
<h3 class="expressway full-width"><a href="/about/careers/network_engineer_voip_telephony">Network Engineer - VoIP Telephony</a></h3>
<div class="career-summary">
<p>
Provide daily support, proactive maintenance and independent troubleshooting, and identify capacity/performance issues to ensure
</p>
</div>
<p class="locations-heading"><b>Locations</b></p>
<ul class="locations-list normal">
<li>
Elizabethtown Headquarters
</li>
</ul>
<div class="list-bottom">
<a class="learn-more replace" href="/about/careers/network_engineer_voip_telephony">Learn More</a>
</div>
Here is what I have so far:
<?php
$url = "http://bluegrasscellular.com/about/careers/";
$input = @file_get_contents($url) or die("Could not access file: $url");
$regexp = "<h3 class=\"expressway full-width\"><a\s[^>]*href=\"\/about\/careers\/(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
if (preg_match_all("/$regexp/siU", $input, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// $match[2] = link address
// $match[3] = link text
echo "<a href='http://bluegrasscellular.com/about/careers/{$match[2]}'>{$match[3]}</a><br>";
}
}
?>
All that does however is pulls the text and href off the . I am wanting to also grab the following:
- Provide daily support, proactive maintenance and independent troubleshooting, and identify capacity/performance issues to ensure
- Elizabethtown Headquarters
I am eventually wanting to store these in a database and notify me of any new positions. I have no clue how to go about this. Any help is greatly appreciated.