For example my site is mysite.com. Here is source of this site:
<html>
<head>
<title>site</title>
//here is many javascript and css codes
</head>
<body>
<div>
<table border="1">
<tr>
<td><a href="somthing.html">Here is a text</td>
<td><img src="image.gif" alt="this is image"/></td>
</tr>
</table>
</div>
</body>
</html>
How can I using php get only text and image without all tags(javascript codes, links, tables and other)?
I want get only “here is a text” and “image.gif”.
Use PHP cURL if the file is on the internet else you can use the
file_get_contents()function if the file on the local machine.To get rid of the extra tags you can use the code:
Alternatively you can use the DOM approach also.