Page 1 of 1

Newbie question : Using PHP to to receive and forward xml

Posted: Tue Jun 18, 2002 5:19 pm
by heyniwe
Hi,
Totally new to PHP so please forgive any ignorance.

I have a Flash built eCommerce website which needs to send/receive xml requests/responses from a banks server. My problem is that Flash can only send and load xml data from its own webserver.

My idea is to use a PHP script as sort of a proxy server that will sit on my webserver and receive the xml request from the client...pass it on to the bank server, receive the xml response from the bank and pass it back to the client.

Can this be done with PHP? If so, does anyone have any good advice and were a PHP newbie should start to try and figure this out?

Much Thanks in advance!
nick

Posted: Tue Jun 18, 2002 5:42 pm
by pacco
I'm no expert, but this should be possible using PHP's network and file functions.

Once the PHP script on your server receives the information from the Flash program, it should open a socket with fsockopen(), then send and receive protocol data using the file functions fputs() and fgets(). Once it is finished it should close the socket with fclose() and output the data back to your flash program.

Check the manual for those functions and it should become clear how to go about using them for your purpose.

Posted: Wed Jun 19, 2002 9:03 am
by mikeq
I would imagine the banks server is using some kind of encryption, fsockopen may not work with this :?