473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How to extract html code from a PHP/text File

I need to extract the html code from a file which contains html and php codes.
for eg. if the file is looks like
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><title>Html code<title></head>
  3. </head>
  4. <?php
  5. echo "Hello Everyone! Thanks in advance";
  6. ?>
then my required output should be
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><title>Html code<title></head>
  3. </head>
May 8 '15 #1
1 1473
Rabbit
12,516 Expert Mod 8TB
Find every occurrence of the string "<?"
, then find its corresponding "?>" and remove everything in between.
May 8 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jcwmtl | last post by:
Hello I'm a complete php noob and a non-programmer. I would appreciate any help. I have a form which takes user input. On submit, the form will run a php script that will create a new text file...
7
by: Christian Schmitt | last post by:
Hi, I want to write a script that (run from a file on the local HD) reads another local html-file into a variable, then make some changes to it, and then output the result in a way that makes it...
2
by: Christian Schmitt | last post by:
Hi, I posted this on Friday, but didn't get a satisfactory answer. Therefoer I post it again with some clarifications. I want to write a script that (run from a file on the local HD,...
2
by: Progster | last post by:
I'd like to write a DLL in C++ which does text file IO. I plan to be using the VS .Net Dev environment, but I want the DLL to work without ..Net runtime on the machine. If I understand this...
3
by: ACaunter | last post by:
Hi all, I was wondering why when i create a text file and download it through my website, the download will include all the html code for the given page at the bottom of the text file. i'm...
2
by: Nathan Sokalski | last post by:
I have a page which reads the the first line of every *.txt file in a certain directory of mine to use as the Text property of a HyperLink Control. However, in one of my recently added text files...
3
by: Axel Gallus | last post by:
I wrote a javascript function which should return the html code between a frame's body tag: function load_frame_as_string( Framename ) { var Frame =...
3
by: nandha2808 | last post by:
this code for aspx.cs: string inputString; resultLabel.Text = ""; using (StreamReader streamReader = File.OpenText(@"E:\projects\readtxt\nan.txt")) { ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.