Title: how send xml file
Last modified: August 30, 2016

---

# how send xml file

 *  Resolved [stromdh](https://wordpress.org/support/users/stromdh/)
 * (@stromdh)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/how-send-xml-file/)
 * How do I submit an xml email form?
 * i need send this xml with the inputs for a aplication that will consume a web-
   service
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [stromdh](https://wordpress.org/support/users/stromdh/)
 * (@stromdh)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/how-send-xml-file/#post-6825667)
 * nobody know nothing in this forum… if anyone needs, here it is:
 * `add_action( ‘wpcf7_before_send_mail’, ‘cria_xml_cf7’ );
 * function cria_xml_cf7( $cf7 )
    { function addContato($document, $nome, $email,
   $assunto, $mensagem) { #criar contato $contato = $document->createElement(“contato-
   body”); #criar nó nome $nomeElement = $document->createElement(“nome”, $nome);
   $emailElement = $document->createElement(“email”, $email); $telefoneElement =
   $document->createElement(“assunto”, $assunto); $mensagemElement = $document->
   createElement(“msg”, $mensagem); $contato->appendChild($nomeElement); $contato-
   >appendChild($emailElement); $contato->appendChild($telefoneElement); $contato-
   >appendChild($mensagemElement); return $contato; } $dom = new DOMDocument(“1.0”,“
   ISO-8859-1”); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $root
   = $dom->createElement(“item”); #utilizando a funcao para criar contatos $cf7Nome
   = $_POST[“nome”]; $cf7Email = $_POST[“email”]; $cf7Assunto = $_POST[“assunto”];
   $cf7Msg = $_POST[“msg”]; $item = addContato($dom, $cf7Nome, $cf7Email, $cf7Assunto,
   $cf7Msg); #adicionando no root $root->appendChild($item); $dom->appendChild($
   root); #salvando o arquivo $dom->save(date(‘d-m-Y’).”nome.xml”); #mostrar dados
   na tela header(“Content-Type: text/xml”); $dom->saveXML(); } ‘

Viewing 1 replies (of 1 total)

 The topic ‘how send xml file’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [stromdh](https://wordpress.org/support/users/stromdh/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/how-send-xml-file/#post-6825667)
 * Status: resolved