私は仕事を探しています。そして、私は 1 日 1 回 cron を実行するスクリプトに取り組んでいます。Web サイトからテキストとリンクを取得しています。正規表現パターンに関しては無力です。
以下は、私が取得しているデータの例です。
<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>
これが私がこれまでに持っているものです:
<?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>";
}
}
?>
ただし、テキストと href を から引っ張るだけです。私はまた、次のものをつかみたいと思っています:
- 毎日のサポート、プロアクティブなメンテナンス、独立したトラブルシューティングを提供し、容量/パフォーマンスの問題を特定して、
- エリザベスタウン本社
私は最終的にこれらをデータベースに保存し、新しい位置を通知したいと考えています。どうすればいいのかわかりません。どんな助けでも大歓迎です。