Convert HTML output into a plain text using php

倾然丶 夕夏残阳落幕 提交于 2019-12-06 10:39:07

Use php strip_tags

If strip_tags is not working for then maybe you can use regex to extract the info you want.

Try using PHP preg_match with /(<td>.*?<\/td>)/ as the pattern

Have a look at simplexml_load_file():

http://www.php.net/manual/en/function.simplexml-load-file.php

It will allow you to load the HTML data into an object (SimpleXMLElement) and traverse that object like a tree.

try to use PHP function strip_tags

try this one,

<?php
$data = file_get_contents("your_file");
preg_match_all('|<div[^>]*?>(.*?)</div>|si',$data, $result);
print_r($result[0][0]);
?>

I have try this one, and it seems work for me, for you too i hope

You can use the strip_tags php function for this. Browse through the comments in the php manual page of the strip_tags function to see how you can use this in a good way.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!