// This problem can be solved adding the “s” modifier to the regular
// expression. With this modifier, the “.” wildcard character matches
//any possible character in the string, including newlines:
preg_match("#<body>(.*)</body>#s",$document,$matches)