socket connetion to url with port 80

Sakcee sakcee at gmail.com
Tue Apr 4 17:02:12 EDT 2006


Hi

this is really a stupid question,  how can i get page rsponse from a
site e.g. google.com port 80
form socket, can i do something

import socket
s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
s.connect( ( "www.google.com", 80 ) )
s.send( "Hello" )  # GET??
response = s.recv(8048)
print response

can i do soemthign like that , can i send somehting to google and get
webpage in return, I know that I can use urllib or httplib etc, but can
i do at socket level?

thanks




More information about the Python-list mailing list