POST and GET between Python back-end and PHP front-end -


i trying make python back-end send message php front-end via post , get. found following snippet after google search. trying working understand how both ends talk each other.

i using "requests" http post.

python code (test_bot.py):

import requests  userdata = {"firstname": "john", "lastname": "doe", "password": "jdoe123"} resp = requests.post('http://127.0.0.1/front.php', params=userdata) 

php code (front.php):

<?php $firstname = htmlspecialchars($_get["firstname"]); $lastname = htmlspecialchars($_get["lastname"]); $password = htmlspecialchars($_get["password"]); echo "firstname: $firstname lastname: $lastname password: $password"; ?> 

after run python code, went , check php output here: http://127.0.0.1/front.php

all is:

firstname: lastname: password:

how data? have both files under /var/www/html

i new concept. sure missing something. pointer help.

thanks.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -