REQUEST POST

Asked

Viewed 76 times

1

Greetings,

I have a test python server:

from flask import request, Flask

app = Flask (__name__)

@app.route ('/Teste', methods=['POST'])
def teste():
 recebido = request.form['variavel'] 
 print(recebido)
 return 'OK'
 
if __name__ == "__main__":
 app.run () 

In python I can also, as a test, perform a POST to check if the server is working:

import requests
requests.post("http://127.0.0.1:5000/Teste", data={'variavel': 'TUDOOK'})

I have no familiarity with C++ except for reading and implementing simple things, I am playing an engine of an old game and I managed to make an option to access a site (which by default is GET method). How do I submit a POST request as simple as in python above? In this case, I don’t care about the server answer, I just want to send the variable and close, as in the example above.

NOTE: I saw some posts using CURL, in this case it would be only with a line also using it? Or would be more practical an example like this: https://curl.se/libcurl/c/http-post.html without the answer? If yes, what would CURL *Curl; (how does the pointer work in this case)?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.