开发者

PHP/Curl: Accessing an external web API through an intermediate server

开发者 https://www.devze.com 2023-04-12 07:58 出处:网络
I have a server that accesses an external API not from our company via HTTP GET. It can only be accessed from the IP address of the registered server A.

I have a server that accesses an external API not from our company via HTTP GET. It can only be accessed from the IP address of the registered server A.

I now need some of the information from that API on a second server B. However, using PHP+Curl it does take quite long to sen开发者_运维问答d a request from server A to server B that then forwards it to the API and all the way back.

How can I speed things up?

System: Ubuntu 10.10 / server A and B are with the same hosting company / PHP is used with MySQL / programming something in C would be an option


You should use a web server on Server A to act as a reverse proxy for the external API (With access only from Server B) and they access the API as if it was accessible on Server A.

There is a tutorial on how to configure reverse proxies in apache on Apache Tutor.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号