curl-and-python

Re: who can give me a sample code, get a website page via socks5 proxy?

From: Kjetil Jacobsen <kjetilja_at_gmail.com>
Date: Wed, 26 Apr 2006 15:01:03 +0200

hello,

the correct way of specifying that you want to use proxytype socks5 in
your example would be something like this:
"""
c.setopt(c.PROXYTYPE, c.PROXYTYPE_SOCKS5)
"""
    - kjetil

On 4/23/06, juhui <phpbird_at_gmail.com> wrote:
> Hi:
> I want to get a page with pycurl via socks5 proxy. The code looks like below.
>
> import pycurl
> c = pycurl.Curl()
> c.setopt( pycurl.URL, 'http://www.test.com/test.html' )
> import StringIO
> b = StringIO.StringIO()
> c.setopt( c.WRITEFUNCTION, b.write )
> c.setopt( c.FOLLOWLOCATION, 1 )
> c.setopt( c.MAXREDIRS, 5 )
> c.setopt(c.PROXY,'www.test.com:1080')
> #c.setopt(c.PROXYTYPE,'SOCKS5')
> c.setopt(c.PROXYUSERPWD, 'user:pass')
> c.perform()
> print b.getvalue()
>
> but it doesn't work..
>
> how to use socks5 proxy in pycurl?
>
>
> thanks.
>
> --
> LB can FlY
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2006-04-26