How does php curl achieve instant feeling? Still, it has to be ajax?.

how can the data obtained by

curl when doing a http request
be made immediately? That is, you don"t have to rearrange entering data every once in a while or when you have data
I know ajax can, but won"t there be cross-domain name problems? Although on the same host, but different server
, how does curl achieve real-time? What can be done with it?


write curl in a separate php and act as a proxy. Every time the front end wraps up the data, use ajax to send a request to the php, to get the data in php, repackage it and send it to the real address, and then reture the returned content to the front end page. In this way, there is no cross-domain problem at the frontend (because the real request is sent from the backend). In addition, you can hide the actual interface address (for example, if it is deployed on the Aliyun platform, the interface domain name can be replaced by the private network address of the cloud platform).

Menu