I want to send some data to my website/webserver
In the Godot code i use the Template from the docs.
var dict = {'tscn': 'info'}
func _ready():
_make_post_request('https://keys.quuli.ch/level.php', dict, true)
func _make_post_request(url, data_to_send, use_ssl):
# Convert data to json string:
var query = JSON.print(data_to_send)
print(query)
# Add 'Content-Type' header:
var headers = ["Content-Type: application/json"]
$HTTPRequest.request(url, headers, use_ssl, HTTPClient.METHOD_POST, query)
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
var response = body.get_string_from_utf8()
print(response)
and on my Webserver i just simply print the information that was given like this.
<?php
print_r($_POST);
Now if i run the script i expect it to return the dict i made at the top but the array returned by PHP is empty ... do you have an idea why that is and how to fix it?