How to use proxy?

here is my code:
require ‘rubygems’
require ‘net/http’
require ‘open-uri’
$proxy_addr = ‘128.59.20.226’
$proxy_port = ‘3124’
Net::HTTP::Proxy($proxy_addr,
$proxy_port).start(‘http://www.ruby-forum.com/’) {|http|
http.get(‘http://www.ruby-forum.com/’)
}
the output is :
#<Net::HTTPServiceUnavailable 503 Service Unavailable readbody=true>
what’s wrong?
i can ping 128.59.20.226

[email protected]:~$ ping 128.59.20.226
PING 128.59.20.226 (128.59.20.226) 56(84) bytes of data.
64 bytes from 128.59.20.226: icmp_seq=1 ttl=45 time=286 ms
64 bytes from 128.59.20.226: icmp_seq=2 ttl=45 time=286 ms
64 bytes from 128.59.20.226: icmp_seq=3 ttl=45 time=290 ms
64 bytes from 128.59.20.226: icmp_seq=4 ttl=45 time=289 ms
64 bytes from 128.59.20.226: icmp_seq=5 ttl=45 time=285 ms
64 bytes from 128.59.20.226: icmp_seq=6 ttl=45 time=288 ms
64 bytes from 128.59.20.226: icmp_seq=7 ttl=45 time=291 ms
64 bytes from 128.59.20.226: icmp_seq=8 ttl=45 time=289 ms
64 bytes from 128.59.20.226: icmp_seq=9 ttl=45 time=290 ms
64 bytes from 128.59.20.226: icmp_seq=10 ttl=45 time=285 ms
64 bytes from 128.59.20.226: icmp_seq=11 ttl=45 time=285 ms
64 bytes from 128.59.20.226: icmp_seq=12 ttl=45 time=286 ms
64 bytes from 128.59.20.226: icmp_seq=13 ttl=45 time=289 ms
64 bytes from 128.59.20.226: icmp_seq=14 ttl=45 time=289 ms
64 bytes from 128.59.20.226: icmp_seq=15 ttl=45 time=284 ms
64 bytes from 128.59.20.226: icmp_seq=16 ttl=45 time=291 ms
64 bytes from 128.59.20.226: icmp_seq=17 ttl=45 time=285 ms
64 bytes from 128.59.20.226: icmp_seq=18 ttl=45 time=289 ms
64 bytes from 128.59.20.226: icmp_seq=19 ttl=45 time=286 ms
64 bytes from 128.59.20.226: icmp_seq=20 ttl=45 time=285 ms
64 bytes from 128.59.20.226: icmp_seq=21 ttl=45 time=287 ms
^C
— 128.59.20.226 ping statistics —
21 packets transmitted, 21 received, 0% packet loss, time 20024ms
rtt min/avg/max/mdev = 284.959/287.864/291.207/2.180 ms

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs