Click to See Complete Forum and Search --> : Form --> xml --> remote server --> reply -->format in html/php


parkypoo22
04-12-2006, 03:21 PM
Hey guys,

Having never played with xml before im after a piece of php coding to do the below:

HTML Form --> xml --> remote server --> reply -->format in html/php

Im collecting two pieces of user input, telephone and postcode.

Need to post to a remote server, telephone, postcode, username, password, and ID.

xml has to be posted in the following schema

<?xml version="1.0" encoding="UTF-8" ?>
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:element name="check">
- <xs:annotation>
<xs:documentation>example xml schema</xs:documentation>
</xs:annotation>
- <xs:complexType>
- <xs:all>
- <xs:element name="sp">
- <xs:complexType>
- <xs:all>
- <xs:element name="username">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="50" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="password">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="50" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="id">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:length value="3" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
- <xs:element name="check">
- <xs:complexType>
- <xs:all>
- <xs:element name="telephone">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="12" />
<xs:whiteSpace value="collapse" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="postcode" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="9" />
<xs:whiteSpace value="preserve" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>

Having posted the above to the remote server, i then want to format the reply in a nice fluffy userfriendly html/php formated page.

reply will be in the following format:


<?xml version="1.0" encoding="UTF-8" ?>

- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xs:element name="check">
- <xs:annotation>
<xs:documentation>example results</xs:documentation>
</xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:element name="results">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="info1">
<xs:complexType />
</xs:element>
- <xs:element name="info2">
<xs:complexType />
</xs:element>
- <xs:element name="info3">
<xs:complexType />
</xs:element>
- <xs:element name="info4">
<xs:complexType />
</xs:element>
- <xs:element name="info5">
<xs:complexType />
</xs:element>
- <xs:element name="info6">
<xs:complexType />
</xs:element>
- <xs:element name="info7">
<xs:complexType />
</xs:element>
- <xs:element name="info8">
<xs:complexType />
</xs:element>
- <xs:element name="info9">
<xs:complexType />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="error">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="error_number">
<xs:complexType />
</xs:element>
- <xs:element name="error_desc">
<xs:complexType />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>



Would really appreciate any help, looking for a quick fix here!

Thanks

Matt :)

parkypoo22
04-14-2006, 02:20 PM
Hmmm...

Im still messing around on this one and not getting very far, really would appreciate a helping hand!

Webnerd
04-18-2006, 08:13 AM
So, you want us to interpret the Schema and generate the XML for you?

Webnerd
04-18-2006, 08:20 AM
Sending:


<?xml version="1.0" encoding="utf-8"?>
<check>
<sp>
<username/>
<password/>
<id/>
</sp>
<telephone/>
<postcode/>
</check>



Receiving:


<?xml version="1.0" encoding="utf-8"?>
<check>
<error>
<error_number/>
<error_desc/>
</error>
<results>
<info1/>
<info2/>
<info3/>
<info4/>
<info5/>
<info6/>
<info7/>
<info8/>
<info9/>
</results>
</check>


Now the real question is, are you going to POST the data to a page? If so, what page? Does it run PHP4? Does it have DOMXML installed? Does it have cURL installed?