PHPスクリプト/file_get_contents() の変更点


*file_get_contents() [#d37dd1cc]

ファイルの内容を全て文字列に読み込む

**書式 [#cd342cf6]
 string file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )

**例 [#s643d3e1]
ホームページのタイトル<title></title>を抜き出して表示
<?php
 <?php
 $d = file_get_contents("http://ma21.ath.cx/");
 $d = @mb_convert_encoding($d, "EUC-JP", constant("TO_ENCODING"));
 preg_match("/<title[^>]*>([^<]*)<\/title>/i",$d,$t);
 $title = trim($t[1]);
 print $title;
?>
 ?>