I am struggling to convert this VB.NET code to PHP as It is from an API, and they have no php code examples for me to check my code, or any before or after if there is an issue, So I cannot tell if it is this function which is not working or there is an issue with the API
Const PSK As String = "YOUR_PSK_GOES_HERE"
Function Request(url As String, json As String) As String
Dim client = New WebClient()
client.Headers(HttpRequestHeader.ContentType) = "application/json"
Dim sig = Sign(json + PSK)
Return client.UploadString(url + "?Format=JSON&Signature=" + sig, json)
End Function
This is my solution
function request($url, $json) {
$psk = "--------";
$sig = sign($json . $psk);
$url = $url . "?Format=JSON&Signature=" . $sig . $json;
$result = file_get_contents($url);
return $result;
}
I am unsure how to attach the , json, inside the UploadString
Am I making a mistake?