[PHP] 指定のURLから画像のみを取り込む

2006年11月15日 水曜日 14時11分
E-Mail This Post/Page Print This Post/Page

既存のURLから、画像のみを取り込んで表示させるということが php では可能です。もともと get_file_contents() や file() を使えばページのコンテンツをそのまま取り込むことができますので、これに手を加えてイメージのみを抽出するという形になります。

比較的シンプルなコードでできます。 $url を任意のものに書き換えます。 stript_tags() は変数内の html タグを取り払います。パラーメーターで 取り払わないタグを指定できますので、ここで<img>を入力します。

PHP:
  1. $url = "http://www.yahoo.com";
  2. $file = file_get_contents ($url);
  3. $file = strip_tags($file, '<img>');
  4. echo $file;

この記事に関連する NEWS

この記事に関連するトピック

このエントリーへの Yahoogle Suggestions

Trackback this Post |

 

記事ヒット TOP 10

IT 関連 NEWS

    There is no entries available for this category.

PHP関連 NEWS

    There is no entries available for this category.

PHP Tips from Social Bookmarks

    There is no entries available for this category.

PHPに関するフォーラムトピック

    There is no entries available for this category.

Tag Cloud

admin Admin Drop Menus Admin Memo Admin Panel advanced drop menus array unique blog cron dabeya Dagon Design Sitemap Generator dropcap Edit N Place error Feedburner game google hack html HTML CSS Internet NEWS Permalink Redirect PHP phpBB2 plugin RSS scripts search stattraq template the content Ultimate Tag Warrior Web Management Windows XP Wordpress WP Plugins WPページ  拡張子 カスタマイズ カスタム関数 カテゴリー コード セキュリティ タグ トップページ トラックバック フィード 投稿 抜粋 日本語 時刻 時間 正規表現 表示 記事

サイト メニュー

Blogtimes image
ぱそずき :D)‐く © 2008
Close
E-mail It