Hi, How do porting this pyhon code to b4a(python code as below)
my ported b4a code is:
it is not work correctly, what is wrong?
Set HTTP Request Header with OkHttpUtils2
Python:
import requests
url = ("https://api.telegram.org/bot1312461372:AAEfxqjSM_P6N_ljxxxUPSOVMLcEi005lE/sendmessage?chat_id=8xxx25988&text=Hello")
payload = {
"UrlBox": url,
"AgentList": "Mozilla Firefox",
"VersionsList": "HTTP/1.1",
"MethodList": "GET"
}
req = requests.post(
"https://www.httpdebugger.com/Tools/ViewHttpHeaders.aspx", payload)
print(req)
my ported b4a code is:
B4X:
dim Url as string = "https://api.telegram.org/bot1312461372:AAEfxqjSM_P6N_ljxxxUPSOVMLcEi005lE/sendmessage?chat_id=8xxx25988&text=Hello"
dim hj as httpjob
hj.initialize
hj.poststring("https://www.httpdebugger.com/Tools/ViewHttpHeaders.aspx",$"UrlBox=${url}&AgentList=${"Mozilla Firefox"}&VersionList=${"HTTP/1.1"}&MethodList=GET"$)
it is not work correctly, what is wrong?
Set HTTP Request Header with OkHttpUtils2