Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80))

I'm trying to use the library HTTParty, but whenever I run the code below I receive an error.

Code:

require 'httparty'
response = HTTParty.get('http://example.com')

When I run the code I receive the error: Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80)). I don't get any error when I run the same code in net/http. I don't know if this helps, but the system I'm running is Linux Mint 18.3 Cinnamon 64-bit .

like image 713
Practical1 Avatar asked Nov 15 '18 01:11

Practical1


1 Answers

I know that this is late, but using https://example.com instead of http://example.com was the solution to my problem.

like image 174
Practical1 Avatar answered Sep 19 '22 08:09

Practical1