2015-06-25 2 views
-3

Я хочу обновить тег набора и заменить +923455252632 на +923333578357 вот код;Редактировать мой XML-файл с помощью php

<?xml version="1.0" encoding="UTF-8"?> 
<Response> 
    <Say voice="alice">Thanks for the call. Configure your number's voice U R L to change this message.</Say> 
    <Pause length="1"/> 
    <Say voice="alice">Let us know if we can help you in any way during your development. you are a good person </Say> 
    <Dial>+923455252632</Dial> 
</Response> 
+0

если это все, что вы хотите сделать, сохранить XML в виде строки и использовать str_replace – treegarden

+0

я должен заменить весь XML или просто раздел набора? –

ответ

0

Я нашел решение, вот оно.

$myfile = fopen("message.xml", "w") or die("Unable to open file!");// opens file in write mode @ftruncate($myfile, 0);// trancate previous contant in the xml file named message $txt = '<?xml version="1.0" encoding="UTF-8"?> <Response> <Say voice="alice"> Your call is being transferred to one of our company employees</Say> <Pause length="1"/> <Say voice="alice"> Please wait.</Say> <Pause length="1"/> <Say voice="alice"> Please wait.</Say> <Say voice="alice">Let us know if we can help you. you are a good person </Say> <Dial>'.$employee.'</Dial> </Response>'; fwrite($myfile, $txt);// Write contant in the file fclose($myfile);// Close file

Смежные вопросы