M
Muddy Coder
Hi Folks,
My previous post got a many helps from the people, and I tested what
they suggested. Since this topic maybe needed in future, so I drop
these lines below to help the future programmers. The methods worked
as below:
1. This method was suggested by Cameron Laird:
os.system("start %s" % URL)
It works. But, if the URL contains character &, it will fail. For
example, if URL has only one field, such as: http://www.mydomain.com/ascript.cgi?user=muddy
this method works well. But, if there more than one field need to be
input, such as http://www.mydomain.com/ascript.cgi/user=muddy&password=foo,
the field password failed to reach server, and the CGI script
complained.
2. The best way is to use urllib2, suggested by Ron Barak, my code is
below:
import urllib2
source = urllib2.urlopen(URL).read()
print source
It successfully triggered CGI script, and also got feedback from
server. It works very well!
My thanks go to all the helpers!
Muddy Coder
My previous post got a many helps from the people, and I tested what
they suggested. Since this topic maybe needed in future, so I drop
these lines below to help the future programmers. The methods worked
as below:
1. This method was suggested by Cameron Laird:
os.system("start %s" % URL)
It works. But, if the URL contains character &, it will fail. For
example, if URL has only one field, such as: http://www.mydomain.com/ascript.cgi?user=muddy
this method works well. But, if there more than one field need to be
input, such as http://www.mydomain.com/ascript.cgi/user=muddy&password=foo,
the field password failed to reach server, and the CGI script
complained.
2. The best way is to use urllib2, suggested by Ron Barak, my code is
below:
import urllib2
source = urllib2.urlopen(URL).read()
print source
It successfully triggered CGI script, and also got feedback from
server. It works very well!
My thanks go to all the helpers!
Muddy Coder