我正在尝试从给定的 url 解析文本内容。这是代码:
<?php
$url = 'http://stackoverflow.com/questions/12097352/how-can-i-parse-dynamic-content-from-a-web-page';
$content = file_get_contents($url);
echo $content; // This parse everything on the page, including image + everything
$text=escapeshellarg(strip_tags($content));
echo "</br>";
echo $text; // This gives source code also, not only the text content over page
?>
我只想获取写在页面上的文本。没有页面源代码。有什么想法吗?我已经用谷歌搜索了,但上面的方法只存在于任何地方。