Solved

edit attribute text in xml file using php

Posted on 2008-10-15
2
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

732 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