1 / 10

KECS フォーラム 第三回実践 Web アプリケーション

KECS フォーラム 第三回実践 Web アプリケーション. ~ PEAR の基礎~. 目次. PEAR の導入方法 YAHOO API Google API. 注意  PHP のファイルは文字コード EUC-JP で保存すること. PEAR の導入. PEAR とは -PEAR とは PHP に関するパッケージの保管場所 - 無償で利用可能 - オブジェクト指向で記述されている -URL: http://pear.php.net/. PEAR の導入方法. コマンドプロンプトを起動

morrison
Download Presentation

KECS フォーラム 第三回実践 Web アプリケーション

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. KECSフォーラム第三回実践WebアプリケーションKECSフォーラム第三回実践Webアプリケーション ~PEARの基礎~

  2. 目次 • PEARの導入方法 • YAHOO API • Google API 注意 PHPのファイルは文字コード EUC-JPで保存すること

  3. PEARの導入 • PEARとは -PEARとはPHPに関するパッケージの保管場所 -無償で利用可能 -オブジェクト指向で記述されている -URL: http://pear.php.net/

  4. PEARの導入方法 • コマンドプロンプトを起動 「スタート」→「すべてのプログラム」→「アクセサリ」→「コマンドプロンプト」で起動 • PHPをインストールしたフォルダ(C:\php)へ移動 > cd C:\php • go-pear.batの実行 > C:\php\go-pear.bat 「Would you like to install these as well?[Y/n]:」→Yを押す 「Would you like to alter php.ini<c:\windows\php.ini>?[Y/n]:」Yを押す • Apacheの再起動

  5. プロキシの設定 • 大学内ではプロキシの設定が必要 • C:\phpフォルダ内で以下を実行 > pear config-set http_proxy http://ユーザ名:パスワード@proxyt.doshisha.ac.jp:8080 • 学外ではプロキシの設定が必要無い 学外では以下を実行しプロキシ設定を無効に > pear config-set http_proxy

  6. PEARの実行 • コマンドプロンプトを起動 > pear  コマンド一覧を表示 • パッケージのインストール > pear install XML_Tree > pear install XML_RSS > pear install HTTP_Request インストールしたパッケージが利用可能となる

  7. PEARパッケージの使い方 Webページをダウンロードして表示する peartest1.php-------------------------------------------------- <?php include_once("HTTP/Request.php"); $a = &new HTTP_Request('http://www.yahoo.co.jp/'); $a->setProxy(‘proxyt.doshisha.ac.jp’, 8080, ‘ユーザ名’, ‘パスワード'); $a->sendRequest(); $html_data = $a->getResponseBody(); print $html_data; ?> ------------------------------------------------------------------ 好きなURL プロキシ設定(家ではこの行はいらない) 指定したURL先のHTMLデータを変数に保存

  8. 実行結果

More Related