PHPで任意のタグ間の文字列を抜く
PHPで任意のタグ間の文字列を抜き出す。
ファイル内のすべてのパターンを抜き出し、$matchesに配列で格納。
よく忘れるのでメモ。
$html = file_get_contents("URL or ファイル");
$pattern = "/<span class=¥"entry-content¥".*<¥/span>/";
preg_match_all($pattern,$html,$matches);
PHPで任意のタグ間の文字列を抜き出す。
ファイル内のすべてのパターンを抜き出し、$matchesに配列で格納。
よく忘れるのでメモ。
$html = file_get_contents("URL or ファイル");
$pattern = "/<span class=¥"entry-content¥".*<¥/span>/";
preg_match_all($pattern,$html,$matches);