basic4android - 如何使用 basic4android 发布有效载荷
问题描述
我开始使用 b4a,我想发送带有有效负载(数据)的发布请求。在 python 中它是这样工作的:
requests.post(url,data)
解决方案
在您的项目中引用OkHttpUtils2。并发布数据,例如:
Sub Activity_Create(FirstTime As Boolean)
'Send a POST request
Dim Post As HttpJob
Post.Initialize("Job2", Me)
Post.PostString("http://www.basic4ppc.com/print.php", "key1=value1&key2=value2")
End Sub
Sub JobDone (Job As HttpJob)
'print the result to the logs
If Job.Success = True Then Log(Job.GetString)
Else Log("Error: " & Job.ErrorMessage)
Job.Release
End Sub
推荐阅读
- python - 将 TF-IDF 结果保存到 CSV 文件中
- iframe - 无法在 amp iframe 中加载 html 文件
- javascript - React Bootstrap Table - 尝试用相等的列宽填充页面
- spring-boot - 未找到来自 Maven 依赖项的 spring boot @repository bean
- c++ - Objective C++,如何在后台线程中使用runloop?
- google-bigquery - 优化 BigQuery 查询的费用
- python - Django在创建模型时创建项目默认值不起作用
- tensorflow - 训练和验证准确性有时会卡住
- python - 迭代行时如何更改熊猫df中的值
- python - 如何从python中的CSV列中捕获特定信息