Get contents of BODY without DOCTYPE, HTML, HEAD and BODY tags

后端 未结 7 1587
情话喂你
情话喂你 2021-02-12 17:45

What I am trying to do is include an HTML file within a PHP system (not a problem) but that HTML file also needs to be usable on its own, for various reasons, so I need to know

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-12 18:32

    $site = file_get_contents("http://www.google.com/");
    
    preg_match("/]*>(.*?)<\/body>/is", $site, $matches);
    
    echo($matches[1]);
    

提交回复
热议问题