Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80699

Re: Communicating with a PHP script (and pretending I'm a browser)

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: Communicating with a PHP script (and pretending I'm a browser)
Date 2014-11-13 14:41 -0500
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-972F3A.14411613112014@news.panix.com> (permalink)
References <CACwCsY46yYFQwdYdriTSYSvLYF=xs6L2zanN9gofkWkoHvj_fA@mail.gmail.com> <CACwCsY4WYsN4=Vq2WmG895SwToMdfUAJhLqXaQ_02zzaAMzsTw@mail.gmail.com> <mailman.15778.1415890500.18130.python-list@python.org>

Show all headers | View raw


In article <mailman.15778.1415890500.18130.python-list@python.org>,
 Lie Ryan <lie.1296@gmail.com> wrote:

> On 13/11/14 03:57, Larry Martell wrote:
> > We were all making this much harder than it is. I ended up doing this:
> >
> > wp = urllib.request.urlopen('http://php_page/?' + request.POST.urlencode())
> > pw = wp.read()

You can do this if you want, but it's much easier to use requests 
library (http://docs.python-requests.org/).  Compared to using the raw 
urllib stuff, requests makes it trivial to deal with argument encoding, 
cookie management, and a zillion other little details which will drive 
you crazy if you try to roll your own with urllib.

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Communicating with a PHP script (and pretending I'm a browser) Lie Ryan <lie.1296@gmail.com> - 2014-11-14 01:54 +1100
  Re: Communicating with a PHP script (and pretending I'm a browser) Roy Smith <roy@panix.com> - 2014-11-13 14:41 -0500

csiph-web