# How to use proxy?

**URL:** <https://www.ruby-forum.com/t/how-to-use-proxy/194204>\
**Category:** Ruby\
**Created:** [September 1, 2010, 3:29am UTC](https://www.ruby-forum.com/t/how-to-use-proxy/194204 "2010-09-01T03:29:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luofeiyu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9de0a6/32.png) [@luofeiyu](https://www.ruby-forum.com/u/luofeiyu)\
**Post date:** [September 1, 2010, 3:29am UTC](https://www.ruby-forum.com/t/how-to-use-proxy/194204/1 "2010-09-01T03:29:38Z")

</div>

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://www.ruby-forum.com/)’) {|http|  
http.get(‘[http://www.ruby-forum.com/](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

pt@pt-laptop:~$ 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
