Php Guzzle请求在本地主机上超时

Php Guzzle请求在本地主机上超时,php,guzzlehttp,Php,Guzzlehttp,我试图在本地使用GuzzleHttp,并请求本地URL,但收到操作超时。使用的代码段: $url = 'https://boot-vue.test'; //local domain, tried with other urls as well $client = new \GuzzleHttp\Client([ 'verify' => false, 'timeout' => 5, // Response timeout

我试图在本地使用
GuzzleHttp
,并请求本地URL,但收到
操作超时
。使用的代码段:

    $url = 'https://boot-vue.test'; //local domain, tried with other urls as well
    $client = new \GuzzleHttp\Client([
        'verify' => false,
        'timeout' => 5, // Response timeout
        'connect_timeout' => 5, // Connection timeout
        'peer' => false
    ]);
    $response = $client->request($method, $url, [
        'json' => $data,
        'headers' => $headers,
    ]);
以上代码片段适用于任何公共网站


任何帮助都是值得感激的

迟交答案,但对于面临相同问题的其他人

我相信您正在使用php的开发服务器

php的开发服务器一次只支持一个连接

要解决此问题,您可以切换到apache(lamp/wamp)

在两个单独的端口(一个用于api和实际应用程序)中运行应用程序



希望有帮助。

您是否尝试过增加超时时间是的,即使在增加到300之后也是一样的,机器上是否有防火墙,尤其是BitNinja?我遇到了BitNinja的严重问题,它会随机阻止对远程端点/本地机器端点的大量请求。据我所知,没有防火墙。