Forums

Is it possible to pass a variable to my web app from a php webpage?

I am new to programming, I made a script that logs into a website and extracts some data. I am having trouble passing variables to the script. Is it possible to pass a variable from a php file on my other website and run a script here with it? How would I go about doing this?

First of all, welcome to PA seerk! I hope you enjoy your time with us.

There a few ways to accomplish what you are seeking. One of them is to use the Python CGI module to receive the data and then process it as you would like. Is there some other direction you would prefer to go?

Hi Seerk,

The script that is scraping the website. Where is it running? Are you trying to pass variables / arguments into the script when you run it or are you trying to get it to react to the information that it is scraping from the website?

I guess I just need a bit more clarification about what you are trying to do before I can really think of how to help you.

Cheers

That was my issue too...thus my terse response.

I only need to pass the arguments (3 short strings) to the script when I run it, the script uses the variables and the response is uploaded to a database.

There is no fancy real time reacting or anything, I have a feeling this is really easy I just can't seem to find an answer anywhere.

@seerk: It's still not entirely clear what you mean by script and what you mean by passing arguments. It sounds like what you're looking for is for a php program on your other website to make a web request to PythonAnywhere. Is that correct? Is it a link in a page, or does the php make the request as part of the script? If you post the relevant bits of php and the script that yoe're talking about, perhaps we can help.

@seerk: We're still here if you are. Ready willing and able to help you!