Jump to content

strip only certain tags, remove body tags, but keep its content.


louis_coetzee

Recommended Posts

hi everyone,

 

did not know what to make the subject, but here is what I want to do:

 

I have a string, which gets returned to me from a linux app on my server, it looks something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE> </TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Linux)">
<META NAME="AUTHOR" CONTENT="Administrator">
<META NAME="CREATED" CONTENT="20110106;14170000">
<META NAME="CHANGEDBY" CONTENT="HOD">
<META NAME="CHANGED" CONTENT="20110522;16540000">
<STYLE TYPE="text/css">
<!--
	@page { margin: 0.26in }
	P { margin-bottom: 0.15in; direction: ltr; color: #000000; line-height: 0.15in; text-align: justify; widows: 2; orphans: 2 }
	P.western { font-family: "Arial", sans-serif; font-size: 10pt; so-language: en-US }
	P.cjk { font-family: "Batang", "바탕", serif; font-size: 10pt }
	P.ctl { font-family: "Times New Roman", serif; font-size: 10pt; so-language: ar-SA }
	A:link { color: #0000ff }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" DIR="LTR" STYLE="border: 5.05pt double #000000; padding: 0.67in 0.92in">

<P>I want this and the tags around it, just not the html, head, body and their closing tags.</P>

</BODY>
</HTML>

 

within the body, the tags are each styled for example: <p style="color: red"></p> so I cannot just get rid of all html, I want to get only all the content within the body tags, but without the body tags obviously :)

strip_tags does not work as i need, I only want to strip certain tags.

 

If someone can help me with this i will much appreciate it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.