#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0

    Socket OPTIONS request


    Bah!

    Idiocy on my part
    forgot
    Code:
    sok.send(str.encode("\r\n"))
    after my initial sends.

    I recently just installed Python3 and I think I've included the correct encode for the str. But this code when ran just sits. Is it an issue with my carriage return? I know I'm not decoding the recv str is that required? The move from 2.x to 3.x has been a bit rough.

    Code:
    import socket
    import sys
    
    sok = socket.socket(socket.AF_INET)
    host = "www.website.com"
    port = int(80)
    
    sok.connect((host,port))
    sok.send(str.encode("OPTIONS / HTTP/1.1\r\n"))
    sok.send(str.encode("Host: www.website.com\r\n"))
    
    query = sok.recv(1000)
    print (query)
    sok.close()
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,841
    Rep Power
    480
    did you try the command

    wget www.website.com

    ?
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo