Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6360485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:39:18+00:00 2026-05-24T23:39:18+00:00

Before you say anything, I’ve looked around SO and the solutions didn’t work. I

  • 0

Before you say anything, I’ve looked around SO and the solutions didn’t work. I need to make a post request to a login script in Python. The URL looks like http://example.com/index.php?act=login, then it accepts username and password via POST. Could anyone help me with this?

I’ve tried:

import urllib, urllib2, cookielib

cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
opener.addheaders.append( ('Referer', 'http://www.hellboundhackers.org/index.php') )

login_data = urllib.urlencode({'username' : '[redacted]',
                               'password' : '[redacted]'
                               })

resp = opener.open('http://[redacted].org/index.php?act=login', login_data)
print resp.read()
resp.close()

and a little bit modified:

import urllib, urllib2, cookielib

cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
opener.addheaders.append( ('Referer', 'http://www.hellboundhackers.org/index.php') )

login_data = urllib.urlencode({'act' : 'login',
                               'username' : '[redacted]',
                               'password' : '[redacted]'
                               })

resp = opener.open('http://[redacted].org/index.php', login_data)
print resp.read()
resp.close()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:39:18+00:00Added an answer on May 24, 2026 at 11:39 pm

    You will probably need to look at the HTML source to find out what the login form action URL is. Sometimes it is the same as the page URL itself, but it’s probably different. But since you haven’t shown actual URLs, we can’t help you there.

    The <form> element might look something like:

    <form method="POST" action="/do_login">
    

    In that case, you would use /do_login in your POST url.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before saying anything I have to say that, albeit I'm an experienced programmer in
Hey guys, before you guys say anything I have searched and can not find
Before you say anything I realise there is already very similar questions but they
I'm participating in google code jam. Before anything I want to say that I
Before you say anything, I have read the previously asked questions about this issue.
Ok, the question of the century :) Before you say or think anything, let
Let's say before a user is allowed to view the creation page of a
Read on before you say this is a duplicate, it's not. (as far as
Before someone said that I did not read I may say that I read
Let's say I'd like to start a small linux distro before my ordinary operating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.