, POST, . :
<form action="enter.php" method="post">
<textarea name="post">Enter text here</textarea>
</form>
POST POST ( ), .
, , , Pi <iframe> URL-:
http:
, , <p>, <body> ( <!DOCTYPE>, )
<!DOCTYPE html>
<html>
<head>
...
</head>
<body>
<p>3.1415926535897932384...</p>
</body>
</html>
HTML XML, XML -. BeautifulSoup, XML, HTML.
, XML, Python urllib2. POST Python httplib.
, :
import urllib, httplib
from BeautifulSoup import BeautifulSoup
page = urllib.urlopen('http://www.piday.org/includes/pi_to_1million_digits_v2.html')
soup = BeautifulSoup(page)
pi_list = soup.findAll('p')[0].contents
pi = ''.join(str(s).replace('\n', '') for s in pi_list).replace('<br />', '')
parameters = urllib.urlencode({'post': pi,
'name': 'spammer',
'post_type': 'confession',
'school': 'all'})
headers = {'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'text/plain'}
connection = httplib.HTTPConnection('freelove-forum.com:80')
connection.request('POST', '/enter.php', parameters, headers)
response = connection.getresponse()
print response.status, response.reason
data = response.read()
connection.close()
, , IP-.