別の Web サイトから解析された特定の単語を変更するには?
この PHP コードを使用して、サード パーティの Web サイトからテキストを解析しました。
<?php
include_once 'externalcode/simple_html_dom.php';
set_time_limit(10);
/* update your path accordingly */
$url ='http://maltadiocese.org/lang/en/parishes/attard/';
$html = file_get_html($url) or die ('Information about this Parish is currently unavailable');
foreach($html->find('span[lang=en]') as $webLink){
echo $webLink->plaintext.'<br>';
echo $webLink->href.'<br>';
}
foreach($html->find('div[id=textwidget]') as $Link2){
echo $webLink2->plaintext.'<div style="display:none";>';
}
?>
テキストの解析に成功しました。ここで、解析されたテキスト内の特定の単語のスタイルを変更したいと思います。つまり、パリッシュチャーチオブザサンプションと言って、私のウェブサイトではプレーンテキストとして解析されます。太字にして赤く、下線を付けたいと思います。
このチュートリアルに従いましたが、うまくいきませんでした。
私の意図は、テキストを解析し、CSS ルールに従うように変更することです。
ありがとう