Page 1 of 1

Example for XML communication via HTTP

Posted: Thu Oct 13, 2005 2:28 pm
by mihalka
Dear all,

I'm an absolutely beginner with an intentionto write a demo php with xml / http. The task is sending XML reuests via HTTP (from a PHP script) to on other server and receiving XML response. The request data will be collected from a form and the response data (a list of http refeences).

Is there an example with similray functionality ?

I'll be very happy to start from this level.

Warm regards,

Laszlo

Posted: Thu Oct 13, 2005 2:33 pm
by chrys
Quick question, do you mean AJAX? (Asynchronous Javascript and XML) XMLHttpRequest?

Posted: Thu Oct 13, 2005 2:51 pm
by mihalka
Hello Chrys,

I checked quikly ajax, but I'm not sure if it is applicable. The server with XML engine don't use XMLHttpRequest. The XML request hav to be sent to an *.jsp. To have an asnychron communication is nice to have, but not required: the input form is placed in a html frame. Further the request should be sent from the PHP Server to an other, Tomcat server. The XML request ist not the only communication, from the same script will be accessed a MS SQL Database and finally both data (XML Response + SQL Query result) joined and displayed.

Warm regards,
Laszlo

Posted: Thu Oct 13, 2005 3:09 pm
by chrys
If I u nderstand correctly, you want to make a request to another server through HTTP and receive a response in XML, which you can take in by a PHP script and output it on your site?

Posted: Thu Oct 13, 2005 3:10 pm
by mihalka
Exactly !

Posted: Thu Oct 13, 2005 3:11 pm
by chrys
How does the other server take requests through HTTP? Can you send any variables? Or.. is it always going to be the same XML file?

Posted: Thu Oct 13, 2005 5:23 pm
by bokehman
You can't use XMLHttpRequest to communicate with a third party server.

same question

Posted: Thu Oct 13, 2005 5:45 pm
by anubis
i'm actually trying to find an answer for same question as mihalka.

I posted a topic "accessing header content" earlier, didn't see this thread....my bad!!

is there a way after making a post using a standard html post to access response made by target server??...i.e. to read the http header content response.

for e.g. in CF 7 you can access this through
http(url).get("Filecontent)

Posted: Fri Oct 14, 2005 4:02 am
by timvw
You can use http://www.php.net/curl...


There was a day i didn't have curl available, so i wrote a little function that could post XML to a webservice:

http://timvw.madoka.be/programming/php/client.txt

And i also wrote a function that could recieve XML that was posted:

http://timvw.madoka.be/programming/php/service.txt

Posted: Fri Oct 14, 2005 8:24 am
by jwalsh
Feyd,

That is truely awesome... Is there ANYTHING you don't know?!

:)

Posted: Fri Oct 14, 2005 8:27 am
by feyd
me? Hi, I'm feyd, he's Tim. That's Larry... over there is Curly.. Moe's in the John...

Posted: Mon Oct 17, 2005 3:46 pm
by mihalka
Chrys: the XML communication runs as HTTPServletRequest / HTTPServletResponse. The HTTP Server doesn't evaulate HTTP Header variables. It can only set Header variables (if required), but only with "static" values like user informations. There is also no way change the functionality, because the Server is a product, not a project result.