[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

edit attribute text in xml file using php

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
spanishcaravan
Asked:
spanishcaravan
1 Solution
 
hieloCommented:
$str =file_get_contents("http://www.yoursite.com/file.xml");
$replaceWith="Other message";
$result = preg_replace("#([^<]*)#",$replaceWith,$str);
echo $result;
0
 
spanishcaravanAuthor Commented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now