[mod_python] Calling PHP pages

Bo Jangeborg bo at softwave.se
Mon Apr 18 15:20:55 EDT 2005


Nick wrote:

> You really want to be using urllib2.urlopen with a urllib2.Request 
> object.
>
I really do, thanks !
Here is the solution.

php_req = urllib2.Request(url='http://fakeurl.com/login_py.php')
php_req.add_header('Cookie',req.headers_in['Cookie'])
filehandle = urllib2.urlopen(php_req)

Bo)


> Nick
>
> Bo Jangeborg wrote:
>
>> Hello
>>
>> I need to call a login routine to allow my python pages to coexist 
>> with my current
>> php pages. For this to work I need to pass the cookie information to 
>> the php page.
>>
>> I am using the python urllib and are calling the page with the data 
>> option in the hope
>> that this will pass the cookie information along. This however does 
>> not seem to work.
>>
>> filehandle = 
>> urllib.urlopen('http://fakeurl.com/login_py.php',data=urllib.urlencode(req.headers_in)) 
>>
>>
>> Am I on the right track, or is there another way ?
>>
>> Bo Jangeborg
>> Softwave
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
>
>



More information about the Mod_python mailing list