首页 > 解决方案 > 如何从在 localhost 上运行的另一个程序访问在 localhost 上运行的程序

问题描述

我在本地机器上运行了两个程序:一个 wordpress 和一个 spring boot webservice 我如何从 wordpress 访问 webservice?我已经尝试了以下代码(如果没有“http://”,它也不起作用):

$response = wp_remote_get( 'http://localhost:8088/hello');

当然端口和路径是正确的,但是 localhost 上的两个应用程序似乎无法一起通信,对吗?

标签: urllocalhostport

解决方案


如果有人遇到类似的问题,免费的解决方案是使用免费的 argo 隧道服务。我使用了 Cloudflare,效果很好,我认为您也可以使用 Ngrok。

有一个链接可以帮助您:https ://blog.cloudflare.com/a-free-argo-tunnel-for-your-next-project/


推荐阅读