pycurl login joomla website
Question: I try create small script for login joomla web site whit python pycurl, im
write this code :

    
    
    import sys, re
    import pycurl
    import cStringIO
    import time
    import urllib
    
    def LoginJoomla(url):
        buf = cStringIO.StringIO()
        c = pycurl.Curl()
        c.setopt(c.URL, url)
        post_params = [('usrname','admin'),('passwd','1234567789'),('submit','Login')]
        resp_data = urllib.urlencode(post_params)
        c.setopt(c.POSTFIELDS, resp_data)
        c.setopt(pycurl.POST, 1)
        c.setopt(c.WRITEFUNCTION, buf.write)
        c.perform()
        html = buf.getvalue()
        buf.close()
        print html
    
    LoginJoomla("http://www.domain.com/administrator/index.php?option=com_user&view=login")
    

Bat not working, give me the normal login webpage, please any body can say me
where i wrong.


Answer: Read the BUT first!

You need to get the URL parameters right (I think your URL is bad):

`POST to http://www.example.com/administrator/`

with the **following parameters:**

  * option=com_login
  * task=login
  * username=YOURUSER (not usrname! as you have)
  * passwd

**BUT** from my knowledge about Joomla! autentication, you can't do it this
way, because Joomla! from the web browser will send a token, to make sure the
form was posted from a browser.

If it's not posted from a browser, an error like 'The most recent request was
denied because it contained an invalid security token. Please refresh the page
and try again.'

I know it's possible to remotely login to Joomla!, just keep searching. You
may need a custom authentication plugin.

