Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | StoneForged |
I am trying to connect to an api (Link to it here)
So I followed HTTPS request tutorial but the api keeps responding that I’m using the improper input, even though the dictionary I’m sending has the required parts and I’m using the POST method. Anyone get any ideas on what I’m doing wrong?
extends Node
var d = {
"app_id": "test",
"call": {
"component": "Gateway.getVersion"
}
}
var p = preload("res://Player.tscn")
func _ready():
_make_post_request("http://www.newgrounds.io/gateway_v3.php", d, false)
pass
func _process(delta):
if(Var.new == true):
var player = p.instance()
add_child(player)
Var.new = false
pass
func _on_Area2D_area_entered(area):
Var.speed = 100
Var.hspeed = 105
Var.new = true
queue_free()
pass # replace with function body
func _make_post_request(url, data_to_send, use_ssl):
var query = JSON.print(data_to_send)
var headers = ["Content-Type: application/json"]
$HTTPRequest.request(url, headers, use_ssl, HTTPClient.METHOD_POST, query)
func _on_Area2D_body_shape_entered(body_id, body, body_shape, area_shape):
var bois = $Area2D.get_overlapping_bodies()
for x in bois:
x.queue_free()
Var.speed = 100
Var.new = true
Var.hspeed = 105
Var.score = 0
pass # replace with function body
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
var json = JSON.parse(body.get_string_from_utf8())
print(json.result)
pass # replace with function body