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

你好我正在测试端点,当我运行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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值