Results 1 to 3 of 3

Thread: n00b coding questions

  1. #1

    Joined
    Sep 2013
    Posts
    171
    Userbars
    2
    Thanks
    33
    Thanked
    78/38
    DL/UL
    61/0
    Mentioned
    19 times
    Time Online
    9d 5h 50m
    Avg. Time Online
    3m

    n00b coding questions

    I'm running this piece of code in python.

    Code:
    url = 'randomloginpage'
    body = 'randombody'
    headers = {'Accept-Language': 'en-US,en;q=0.5', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent' : 'Mozilla/5.0 (Windows NT; Win64; x64; rv:26.0) Gecko/20100101 Firefox/26.0 Waterfox/26.0', 'Accept-Encoding' : 'gzip, deflate'}
    request = urllib2.Request(url, body, headers)
    response = urllib2.urlopen(request)
    html = response.read()
    print html
    I receive this response in my web debugger:
    Code:
    	<script type="text/javascript">
    		window.location = 'index.php';
    	</script>
    	<div style="text-align:center; margin-top:20px;"><img src="../../images/layout/loading.gif" /> Logging in...</span>
    The response I get in python.exe is like this weird combination of windings.

    I run the code without the headers and I get the correct response in my web debugger.

    What am I doing wrong? Dx
    Last edited by mt5o5bd; 02-05-2014 at 02:58 AM.

  2. #2
    Josh's Avatar
    Joined
    Dec 2011
    Posts
    415
    Userbars
    2
    Thanks
    25
    Thanked
    378/143
    DL/UL
    82/6
    Mentioned
    120 times
    Time Online
    17d 9h 48m
    Avg. Time Online
    5m
    Going to need more details then that. Just 1 idea, The site you are trying to log into might be checking the referer.

    Note: Im not too familiar with python. But can most likely help
    Last edited by Josh; 02-05-2014 at 02:40 AM.

  3. #3

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    (you need an account to see links)

    I recomend using something like this , just because its nice and simple but it works. Also if u read my tutorials , I use the code from the above link so u can follow along easily .


    (you need an account to see links)
    (you need an account to see links)

  4. The Following User Says Thank You to DarkByte For This Useful Post:

    mt5o5bd (02-17-2014)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •