Send data between two PHP scripts

I want a PHP send a formatted XML string to another PHP , which is located on another server in another part of the city.

Is there a good, clean way to do this?

(PHP5 and all the latest software available)

+4
source share
5 answers

check cURL to publish data between pages.

+7
source

If it were me, I would just send the xml data to another script. You can use a socket from PHP or use CURL. I believe the cleanest solution, although SOAP is also viable if you are not against the overhead of a SOAP request, as well as using the library.

+3
source

I highly recommend running your own RESTful API and generally avoiding SOAP complexity. All you need is a curl extension for processing an HTTP request / response and simple_xml for creating / processing XML. If your data is in a reasonable format, it will be easy for you to push it into an XML string and send it as a POST to another server. This server will respond to the request by reading the XML string from the POST var back to the object and voila! It doesn't have to take you all day to kick it out.

+2
source

XML-RPC or SOAP or just a RESTful API

+1
source

You can use cURL (complex API), http (cleaner), or if you need to do more complex things, you can even use the scriptable browser from simpletest .

+1
source

Source: https://habr.com/ru/post/1277020/


All Articles