Rinza_IE
[ class tree: Rinza_IE ] [ index: Rinza_IE ] [ all elements ]

Source for file sample.php

Documentation is available at sample.php

  1. <?php
  2.  
  3. /**
  4.  * Rinza_IEサンプルプログラム
  5.  * 
  6.  * <p>Tyzohサイト(http://www.tyzoh.jp/)のトップページからリンク情報を抽出して出力する</p>
  7.  * @author Y. Kurei
  8.  * @copyright Copyright (c) 2006, Nihon Unisys, Ltd.
  9.  * @license http://www.tyzoh.jp/rinza/licenses/LICENSE-1.0.txt Rinza Public License
  10.  */
  11.  
  12. require_once 'Rinza/IE/Spider.php';
  13.  
  14. // Proxy設定:ご使用の環境に応じた値に変更してください(Proxyを経由しない場合:NULL)
  15. $http_proxy_host 'proxy.xxxxx.jp';
  16. $http_proxy_port '8080';
  17.  
  18. // コンテンツ取得先URLの設定
  19. $target_URL 'http://www.tyzoh.jp/';
  20.  
  21. // コンテンツ取得
  22. $request_params array(
  23.                            'proxy_host' => $http_proxy_host,
  24.                            'proxy_port' => $http_proxy_port
  25.                           );
  26. $spider new Rinza_IE_Spider($target_URL$request_params);
  27. $contents $spider->getSignificantContent();
  28.  
  29. // 取得コンテンツからのリンク情報抽出
  30. $contents_cnt count($contents);
  31. $all_link array();
  32. $scraper new Rinza_IE_Scraper(NULL'UTF-8');
  33. for ($i 0$i $contents_cnt$i++{
  34.     $scraper->setString($contents[$i]['content']);
  35.     $all_link array_merge($all_link$scraper->getListOfLinks($contents[$i]['url']RINZA_IE_SCRAPER_LINK_INFO_A));
  36. }
  37.  
  38. // 抽出したリンク情報の出力
  39. print_r($all_link);
  40.  
  41.  
  42. /** 
  43.  * This Program is distributed under version 1.0 of the Rinza Public
  44.  * License Agreement, that is bundled with this package in the file
  45.  * LICENSE, and is available through the website at the following URL:
  46.  * http://www.tyzoh.jp/rinza/licenses/LICENSE-1.0.txt.
  47.  * 
  48.  * This is the Original Program.
  49.  * The Initial Developer of the Original Program is Nihon Unisys, Ltd.
  50.  * The Original Program is copyrighted (C) 2006 by Nihon Unisys, Ltd. with
  51.  * all rights reserved.
  52.  * There is NO WARRANTY OF ANY KIND by the Initial Developer of the
  53.  * Original Program.
  54.  */
  55.  
  56. ?>

Documentation generated on Fri, 09 Nov 2007 14:01:29 +0900 by phpDocumentor 1.4.0