今日のDiggin_Scraperチップス#2
<?php //require_once 'Diggin/Scraper.php'; //$scraper = new Diggin_Scraper(); //$scraper->process('//div[@class="post-content"]/ul/li/a', 'phper => ["TEXT", "Alnum"]') // ->scrape('http://www.1x1.jp/blog/2008/05/twitter_japanese_phper.html'); //var_dump($scraper->results['phper']); //訂正↑Alnumじゃだめなので function getusername($var) { return trim(parse_url($var, PHP_URL_PATH), '/'); } require_once 'Diggin/Scraper.php'; $scraper = new Diggin_Scraper(); $scraper->process('//div[@class="post-content"]/ul/li/a', 'phper => ["@href", "getusername"]') ->scrape('http://www.1x1.jp/blog/2008/05/twitter_japanese_phper.html'); var_dump($scraper->results['phper']);
↓
array(38) { [0]=> string(4) "LIND" [1]=> string(6) "akiyan" [2]=> string(3) "bto"
関連:
http://twitter.g.hatena.ne.jp/etu_pirka/20080509
↑
(´-`).。oO(なんでarrayのとこ手書きなんだろう。)