I am looking input for the scenario, where in server1 open the populated data in a form from another server in a new window without you using the activeX and serverside scripting.
How开发者_开发问答 we can do it? Thanks
I'm not too sure I understand the question completely, but you can POST to a website using python's urllib or urllib2 modules:
import urllib
import urllib2
opener = urllib2.build_opener(MultipartPostHandler)
opts = {
'field_name' = value,
'another_field_name' = another_value,
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12',
'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'Accept-Language': 'en-gb,en;q=0.5',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Connection': 'keep-alive'
}
req = urllib2.Request(url, opts, headers)
response = opener.open(req)
#something along these lines should work well for POSTing to a website
You can check out the documentation for urllib and urllib2 here:
http://docs.python.org/library/urllib.html
http://docs.python.org/library/urllib2.html
精彩评论