How to send a dictionary to a online PHP file?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JoaoCesar
:warning: Old Version Published before Godot 3 was released.

I’m struggling trying to understand how HTTPClient and HTTPRequest work.

I have a dictionary and I want to send it to a PHP file (post).

How can I achieve this?

:bust_in_silhouette: Reply From: Zylann

I never tried that before, but if you search in the documentation for “Http” you can find a client example in which you can perform a GET request: http://docs.godotengine.org/en/latest/tutorials/http_client_class.html
In your case you may want to use the POST method, and the data could be sent using JSON.

Thank you so much for your answer!

I’ve tried many times using the HTTPClient class and the HTTPRequest node, but nothing worked for me.

So I grabbed that HTTPClient example in the documentation and modified to make POST requests.

Now it’s working!

JoaoCesar | 2016-11-11 12:12

:bust_in_silhouette: Reply From: yedi

I put together few online HTTP client examples and made simple door control project.
You can download Simple Door Control project from this location

http://yedistudio.com/HMI/Y/index.php/download

I tested the HTTP client with Tomcat server about three months. Three month (non stop !!!) server and HTTP client exchanged data. In three months, was no drop connection or slowdown communication.

This project set to 1920x1080 screen resolution

This page show how run the Simple Door Control project

http://yedistudio.com/HMI/Y/index.php/docs/quickstart

yedi | 2016-11-11 04:29

Thank you so much for the examples!

I took a good look and they are very interesting. Certainly I’ll use them for future references.

I’ve managed to make my game work adapting the HTTPClient example in the documentation, but even so I do appreciate your help.

Thanks again!!!

JoaoCesar | 2016-11-11 12:15