Open Designs Forum » Site Specific
Sending XML through PHP form
(7 posts)-
I'm not very familiar with XML but my boss is asking me to send the forms we use (through PHP) to an xml file so it can go directly to our lead manager. Does anyone know how I can do this? I've been googling and researching for over 2 hours now and I'm not finding much help. Right now I have the site written in PHP, the forms sent through PHP to his email.He gave me an email address for the lead manager but it only accepts xml files. Any help would be greatly appreciated!Posted 4 years ago #
-
Looks like it can be done. XML for PHP developers php to xml Flash can interact with PHP and has built in functions for XML, if that's an option. Hope that helps.Posted 4 years ago #
-
You will need to send the email with an attached XML file. Building the file is just string manipulation, but I don't know how to attach stuff to an email.Posted 4 years ago #
-
With ASP (and presumably PHP) i'd declare the fields in my form and then write whatever they contained when submitted back into a template, then save/send that as plain ascii page. edit: after reading this, not sure if you need to attach this or just send it, why only XML files is intriguing.Posted 4 years ago #
-
The easy way to do this is just to format it into the xml manually in your send file. If it needs to be sent as an attachment you will need to look into mime encoding an email, you will find plenty of classes to do that for you at the php classes website. Either way if it's a once off script, just encode it manually. Strip out any potentially dangerous code from the input (Mostly < and >) and just format it like you would anything else (eg $xml_code .= "\n
" . htmlspecialchars($_POST['username']) . " ";) For something like this where you can pretty much guarantee what input you will be receiving it's really a bit overkill to use some of the dedicated xml handling classes. If you need more help with this let me know.Posted 4 years ago # -
I've actually never written any XML before. I'm familiar with HTML and slightly with XHTML and PHP. Can anyone direct me in the right direction with this?Posted 4 years ago #
-
Have you got an example XML file so we can see what the resulting output should look like, and also describe what parts should be dynamically created via the form.Posted 4 years ago #
Reply
You must log in to post.