これ面白い。
require_once 'html_dom_parser.php';
$dom = file_get_dom('http://www.google.co.jp/search?q=%E3%83%94%E3%82%AB%E3%83%81%E3%83%A5%E3%82%A6&lr=lang_ja&ie=utf-8&oe=utf-8');
foreach ($dom->find('a') as $node) {
$node->innertext = str_replace('ピカチュウ', 'オプーナ', $node->innertext);
$node->href = 'http://www.opoona.com/index.htm';
}
foreach ($dom->find('b') as $node) {
$node->innertext = str_replace('ピカチュウ', 'オプーナ', $node->innertext);
}
print $dom->save();
なんか色々思いついたので、暫らくの間これで遊びます。
