Hi, I have this-
en.wikipedia.org/w/api.php?action=login&lgname=user&lgpassword=password
But it doesn't work because it is a get request. What would the the post request version of this?
Cheers!
Hi, I have this-
en.wikipedia.org/w/api.php?action=login&lgname=user&lgpassword=password
But it doesn't work because it is a get request. What would the the post request version of this?
Cheers!
The variables for a POST request are in the HTTP headers, not in the URL. Check urllib.
edit: Try this (i got it from here):
import urllib
import urllib2
url = 'en.wikipedia.org/w/api.php'
values = {'action' : 'login',
'lgname' : 'user',
'password' : 'password' }
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
Since your sample is in PHP, use $_REQUEST, this holds the contents of both $_GET and $_POST.