当前位置:   article > 正文

php curl采集被拒绝,curl(7):无法连接到本地端口8000:连接被拒绝

curl 7

你好我正在测试端点,当我运行php testing.php时,我得到这个错误。任何帮助将不胜感激。curl(7):无法连接到本地端口8000:连接被拒绝

Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 7: Failed to connect to localhost port 8000: Connection refused [url] http://localhost:8000/api/programmers' guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php:359 ...

我试过127.0.0.1以及和它没有工作

这里是testing.php

require __DIR__.'/vendor/autoload.php';

use Guzzle\Http\Client;

// create our http client (Guzzle)

$client = new Client('http://localhost:8000', array(

'request.options' => array(

'exceptions' => false,

)

));

$nickname = 'ObjectOrienter'.rand(0, 999);

$data = array(

'nickname' => $nickname,

'avatarNumber' => 5,

'tagLine' => 'a test dev!'

);

$request = $client->post('/api/programmers', null, json_encode($data));

$response = $request->send();

echo $response;

echo "\n\n";

2016-03-14

Ris

+1

而你认为我们可以帮助连接拒绝错误?这是一个服务器问题,与编程无关。服务器显然拒绝连接,你需要改变它。 –

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/719339
推荐阅读
相关标签
  

闽ICP备14008679号