Websurfing

I’m surfing the internet – from my python shell 😛

#!/usr/bin/python

import os,sys,math,socket

print “Hello world!”

print “Socket test”

s = socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.settimeout(10);
s.connect((“www.amssolarempire.com”,80));
#s.send(“HTTP REQUEST”);
msg = “GET / HTTP/1.1\n”;
msg = msg + “Host: amssolarempire.com\n”;
msg = msg + “Connection: close\n”;
msg = msg + “User-Agent: PythonExperiment\n”;
msg = msg + “\n”;
s.send(msg);
t = ” “;
ret = “”;
while(t!=””):
t = s.recv(1);
ret=ret+t;

print ret;

s.shutdown(0);
s.close();

Comments (0)

› No comments yet.

Leave a Reply


Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pingbacks (0)

› No pingbacks yet.