Solved

edit attribute text in xml file using php

Posted on 2008-10-15
2
343 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
Comment Utility
$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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now