Solved

edit attribute text in xml file using php

Posted on 2008-10-15
2
347 Views
Last Modified: 2008-10-15
this is my xml file :
<?xml version="1.0"?>

<about>
Mission Statement:
our mission is to provide quality web design services....

</about>

i want php code that has a variable $string="our mission is NOT to provide quality web design services"
, and it simply replaces the existing <about> text with the text of $string

any questions, pls ask
0
Comment
Question by:spanishcaravan
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 22725164
$str =file_get_contents("http://www.yoursite.com/file.xml");
$replaceWith="Other message";
$result = preg_replace("#([^<]*)#",$replaceWith,$str);
echo $result;
0
 

Author Comment

by:spanishcaravan
ID: 22725231
hi hielo, thanks, sorry for not explaining but i want the xml file to be changed, instead of just echoing the result
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question