data from a web page

Gerhard Häring gerhard.haering at opus-gmbh.net
Mon Oct 21 04:18:08 EDT 2002


Maschio_77 <maschio_77 at hotmail.com> [2002-10-21 07:31 GMT]:
> Ok , I understand how to use htplib or urllib,now I'm just courios to know
> if I can use socket too, I think something like this:
> 
> s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
> s.connect(www.somesite.com, 80)
> s.send("XXX")
> data=s.recv(1024)
> s.close()
> 
> wich XXX I've to send to receiv the html code from the web server?

http://www.ietf.org/rfc/rfc2616.txt

For a simple HTTP 1.0 GET-request, use something like "GET /".

-- Gerhard



More information about the Python-list mailing list