次のようなテキストファイルがあります。
http://tisue.net/jandek/live.html
<title>Jandek: Live</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
http://news.nationalgeographic.com/news/2004/06/0629_040629_camelspider.html
<title>Camel Spiders: Behind an E-Mail Sensation From Iraq</title>
<meta name="description" content="A photo of a U.S. soldier in Iraq holding massive, hairy, supposedly flesh-eating spiders has been burning up e-mail in-boxes around the world. The arachnids (called camel spiders or wind scorpions) are real, but scientists say many claims about them are anything but.">
そしてさらに数千人。
fopen()
andを使用しfgets()
て各行を読み取り、エコーします。問題は、<title>
と<meta />
がエコーされないことです。行は空白に戻ります。これらをプレーンテキストとして認識し、エコーするようにphpを取得するにはどうすればよいですか?
編集:これが私が使用しているコードです:
$handle = fopen($myFile, 'r');
while(!feof($handle)){
$data = fgets($handle);
echo $data;