http call.

haiyun jiang.haiyun at msn.com
Sat Oct 28 21:25:22 EDT 2006


Steve Holden 写道:
> Kirt wrote:
>> Hi!
>>
>> I have a php program (test.php) on a server. eg:
>> http://abc.xyz.com/test.php
>>
>> I need my python scripts to make a http call to these program pass some
>> data and get back a secret key from the php program..
>>
>> Could anyone help me this, what will i need to make a http call to the
>> php application?
>>
> 
> import urllib
> nf = urllib.urlopen('http://abc.xyz.com/test.php')
> data = nf.read()
> 
> Should get you started. Look for the "mechanize" and "ClientForm" (?) 
> modules to help with the site interactions. It doesn't matter what 
> language the server uses: you will be talking HTTP to it!
> 
> regards
>  Steve
Use urllib2 library , you can take more control.



More information about the Python-list mailing list