Ich habe diesen Code gefunden.
func _ready():
var http_request = HTTPRequest.new()
add_child(http_request)
var url = "https://orf.at"
http_request.connect("request_completed", self, "_on_request_completed")
http_request.request(url)
func _on_request_completed(result, response_code, headers, body):
var response = body.get_string_from_utf8()
print("Response: ", response)
Ich bekomme aber die Fehlermeldung:
Zeile 18:Invalid argument for "connect()" function: argument 2 should be "Callable" but is "res://Node3D.gd".
Zeile 18:Cannot pass a value of type "String" as "int".
Zeile 18:Invalid argument for "connect()" function: argument 3 should be "int" but is "String".
In Zeile 18 steht das
http_request.connect("request_completed", self, "_on_request_completed")