php-general Digest 9 May 2012 07:03:47 -0000 Issue 7806

Topics (messages 317824 through 317828):

Re: How to send XML requests from PHP?
        317824 by: Jim Lucas
        317825 by: Matijn Woudt
        317826 by: Michelle Konzack
        317827 by: Jim Lucas
        317828 by: marco.behnke.biz

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 05/08/2012 10:50 AM, Michelle Konzack 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>h...@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


Look into cURL http://php.net/curl


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

--- End Message ---
--- Begin Message ---
On Tue, May 8, 2012 at 7:50 PM, Michelle Konzack
<linux4miche...@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>h...@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

--- End Message ---
--- Begin Message ---
Hello Jim Lucas,

Am 2012-05-08 11:08:13, hacktest Du folgendes herunter:
> Look into cURL http://php.net/curl

I know "curl" but I do not know, HOW to send the XML stuff.

The XML code is generated using a temp file for logging, which  mean,  I
can see any changes on the system...

Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux
               Internet Service Provider, Cloud Computing
                <http://www.itsystems.tamay-dogan.net/>

itsystems@tdnet                     Jabber  linux4miche...@jabber.ccc.de
Owner Michelle Konzack

Gewerbe Strasse 3                   Tel office: +49-176-86004575
77694 Kehl                          Tel mobil:  +49-177-9351947
Germany                             Tel mobil:  +33-6-61925193  (France)

USt-ID:  DE 278 049 239

Linux-User #280138 with the Linux Counter, http://counter.li.org/

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
On 05/08/2012 11:25 AM, Michelle Konzack wrote:
Hello Jim Lucas,

Am 2012-05-08 11:08:13, hacktest Du folgendes herunter:
Look into cURL http://php.net/curl

I know "curl" but I do not know, HOW to send the XML stuff.

The XML code is generated using a temp file for logging, which  mean,  I
can see any changes on the system...

Thanks, Greetings and nice Day/Evening
     Michelle Konzack


It is data, you send it in the data section of a post. Typically you must also assign it to a variable as you would any other value that you are submitting.

What you should do is capture (using Firefox and viewing the headers) the communication that your browser would perform when submitting the data via FireFox. Once you have that, you will then see how the data needs to be associated.

Sending post data via curl is a matter of formatting the data right and inserting it into the curl request.

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

--- End Message ---
--- Begin Message ---

Michelle Konzack <linux4miche...@tamay-dogan.net> hat am 8. Mai 2012 um
20:25 geschrieben:

> Hello Jim Lucas,
>
> Am 2012-05-08 11:08:13, hacktest Du folgendes herunter:
> > Look into cURL http://php.net/curl
>
> I know "curl" but I do not know, HOW to send the XML stuff.

$ch  =  curl_init ();
curl_setopt ( $ch ,  CURLOPT_URL ,  "http://www.example.com/"; );


Look at http://de.php.net/manual/en/function.curl-setopt.php and set all
other options you need
- post method i guess
- post body with your xml
- ....



curl_exec ( $ch );
curl_close ( $ch );


I you have build up you try and have some code, come back to the list and
tell us what didn't work and what you expect it to do. Then we can help
you. Do have a documentation how the request should look like? Headers to
be sent? Post/Get Parameters? Protocol?

--- End Message ---

Reply via email to