|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Print XML response from PHP
I am working on a project which involves receiving an XML http post, processing it and storing it to an SQL database and returning a XML Response.
I have battled through and have the receiving script working fine but am having problems returning XML data. Below is was im currently using: $xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; $xml_output .= "<DELIVERY_2_SMS>\n"; $xml_output .= "\t<SMSMESSAGE>\n"; $xml_output .= "\t\t<DESTINATION_ADDR>01234567890</DESTINATION_ADDR>\n"; $xml_output .= "\t\t<TEXT>Thankyou for your Message</TEXT>\n"; $xml_output .= "\t\t<TRANSACTIONID>1</TRANSACTIONID>\n"; $xml_output .= "\t\t<TYPEID>2</TYPEID>\n"; $xml_output .= "\t\t<SERVICEID>1</SERVICEID>\n"; $xml_output .= "\t\t<COSTID>2</COSTID>\n"; $xml_output .= "\t</SMSMESSAGE>\n"; $xml_output .= "</DELIVERY_2_SMS>\n"; echo $xml_output; Im assuming my 1st problem is line 1: $xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; when it gets to the end ?> it is closing PHP for the page. I have tried doing \"? >\n"; but when run, the page says invalid whitespace. Is there a simply way round this or am i in the completly wrong direction? Any assistance would be most appreciated Thomas Kirk |
|
#2
|
|||
|
|||
|
Try
Code:
$xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?" . ">\n";
__________________
-james |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Print XML response from PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|