Re: How to send XML requests from PHP?
| From: | Matijn Woudt | Date: | Tue, 08 May 2012 18:11:04 +0000 |
| Subject: | Re: How to send XML requests from PHP? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317825@lists.php.net to get a copy of this message | ||
On Tue, May 8, 2012 at 7:50 PM, Michelle Konzack
<linux4michelle@tamay-dogan.net> wrote:
> Hello *,
>
> I have to implement an interface which must access a Domain-Registration
> API. From the manual I have for example:
>
> ----8<------------------------------------------------------------------
> Example 2.8. Contact Update:valid(change password)
>
> Change password from multipass to green
>
> REQUEST:
>
> Generic Operation: POST(http://backend.example.com/bdom/contact/update/DOJOB0001/1/,xml)
>
> Where xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <request
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <type>PERS</type>
> <sex>MALE</sex>
> <first-name>Otto</first-name>
> <last-name>Normalverbraucher</last-name>
> <organisation>Acme Gmbh</organisation>
> <street>Main Strasse</street>
> <number>13</number>
> <postcode>555555</postcode>
> <city>Newe Stad</city>
> <country>DE</country>
> <phone>+040.0123456789</phone>
> <fax>+040.0123456789</fax>
> <email>hans@nictest.de</email>
> <password>new_secret</password>
> </request>
>
>
> RESPONSE:
>
> <response>1 updated</response>
> ----8<------------------------------------------------------------------
>
> The problem is (I am sitting on my line) that I do not understand how
> to send this XML stuff.
>
> Any hints please?
>
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
>
Try one of the available XML classes that are included in PHP [1].
Both XMLWriter [2] and SimpleXML [3] will do the job.
- Matijn
[1] www.php.net/XML
[2] www.php.net/XMLWriter
[3] www.php.net/SimpleXML