Solved

edit attribute text in xml file using php

Posted on 2008-10-15
2
348 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with mod_substitute 18 35
MySQL limit and not so limited 13 34
Make check boxes work 8 41
Change a button after e-mail 4 19
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

735 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