arhud
arhud

Reputation: 69

How to make a python wsgi script return to php?

I have a php script that passes a value to an http://something..../wsgi.py page which computes and returns a value.

I do not want to display this .py page. Instead, I want to call another php page along with the value computed by the python page.

Any pointers on how to proceed?

Upvotes: 2

Views: 1104

Answers (2)

jsalonen
jsalonen

Reputation: 30521

An elegant solution to this problem would be to return an HTTP redirect response from the Python script. With such a solution, your browser doesn't need to load and display the HTML from the Python script, making the redirection more transparent to the user.

A code snippet creating HTTP redirect with WSGI follows:

def redirector_app(environ, start_response):
   param = '' # Set the parameter you want to pass here
   start_response('301 Redirect', [('Location', 'http:/yourphpscript.com/?param=%s' % param),])
   # ...

Upvotes: 2

Brian Cain
Brian Cain

Reputation: 14619

If a <form> is unacceptable, you can use an HTML <link> or <img> tag in order to make the browser request the indicated URL.

Upvotes: 1

Related Questions