What is the closest ruby version of this php code?

<?php
$url = "https://example.com/secure";

$ch = curl_init() or die(curl_error()); 
curl_setopt($ch, CURLOPT_POST,1); 
curl_setopt($ch, CURLOPT_POSTFIELDS,$param); 
curl_setopt($ch, CURLOPT_PORT, 443); 
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); 
$data1=curl_exec($ch) or die(curl_error());

curl_close($ch); 

$response = $data1;

I started with the following ruby code

uri = URI("https://example.com/secure")
https = Net::HTTP.new(uri.host, 443)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request.set_form_data(params_hash)
response = https.request(request)

It doesn’t work on localhost and I get the following error

but works on the server. I am not sure why it does.

Also, my ruby version of the code doesn’t seem to have anything related to the following php code. what should I do to make it exactly do the same?

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); 

Basically all that I need is a ruby version of the php curl code.