Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bestmomo's avatar

cURL error 7: Failed to connect

Hello,

I use Laravel Http client to send a request to a server on metaverse Second Life with an object in which I set an Http server. When I test a simple GET url on a browser all is OK, idem when I use a POST request with a REST app. But when I use Laravel Http Client (with simple Http:get(...)) I get this issue:

Illuminate\Http\Client\ConnectionException
cURL error 7: Failed to connect to simhost-016abbfc19377d6a6.agni.secondlife.io port 12046: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://simhost-016abbfc19377d6a6.agni.secondlife.io:12046/cap/49561c34-45f8-1f86-bf4e-292749a80acc 

When I check request I get this :

Illuminate\Http\Client\Request {#1269 ▼
  #request: GuzzleHttp\Psr7\Request {#1260 ▼
    -method: "GET"
    -requestTarget: null
    -uri: GuzzleHttp\Psr7\Uri {#1255 ▼
      -scheme: "http"
      -userInfo: ""
      -host: "simhost-016abbfc19377d6a6.agni.secondlife.io"
      -port: 12046
      -path: "/cap/49561c34-45f8-1f86-bf4e-292749a80acc"
      -query: ""
      -fragment: ""
      -composedComponents: null
    }
    -headers: array:2 [▼
      "User-Agent" => array:1 [▼
        0 => "GuzzleHttp/7"
      ]
      "Host" => array:1 [▼
        0 => "simhost-016abbfc19377d6a6.agni.secondlife.io:12046"
      ]
    ]
    -headerNames: array:2 [▼
      "user-agent" => "User-Agent"
      "host" => "Host"
    ]
    -protocol: "1.1"
    -stream: GuzzleHttp\Psr7\Stream {#1259 ▼
      -stream: stream resource @559 ▼
        wrapper_type: "PHP"
        stream_type: "TEMP"
        mode: "w+b"
        unread_bytes: 0
        seekable: true
        uri: "php://temp"
        options: []
      }
      -size: 0
      -seekable: true
      -readable: true
      -writable: true
      -uri: "php://temp"
      -customMetadata: []
    }
  }
  #data: []
}

I dont understand why I have this cURL error. If someone has an idea...

Thanks

0 likes
3 replies
KagisoRabada's avatar

I’ve been wanting to pickup Laravel for a while now. I recently began working on a little personal passion project using the latest Bootstrap. Though I’ve been heavily considering reworking it in Tailwind. I have some experience with PHP.

Over a couple years ago I bought a Laravel (5.8) course on Udemy from Kati Frantz during a sale, unfortunately I didn’t get around to going through it due to other obligations. I revisited the course the other day only to find out it hasn’t be https://omegle.onl/ en maintained and is still for version 5.8.

Should I still go through the course and use Laravel 5.8? Or will most of the material be applicable to Laravel 8? https://vshare.onl/

Should I just use vanilla PHP for my project and just wait for Laravel 9?

I would really appreciate if someone can point me in the right direction to get started with Laravel in my current situation.

Sinnbeck's avatar

Can you show your code? Are you also setting the port when testing in the browser?

bestmomo's avatar

@Sinnbeck In Laravel I simply use

Http::get($url);

or

 Http::post($url, $data);

As I did many times to access API with other projects.

When I test in browser I also set the port.

Please or to participate in this conversation.