Discussions
PHP Authentication not working
almost 7 years ago by Emir Kobaslic
Hi,
I am trying to authenticate to retrieve a token using PHP, but it is not working for me. Below is the code that I am trying to connect with. Could you please help me with this?
// Code Start
"api", "module"=>"staff.login", "method"=>"GET", "username"=>"username", "password"=>"password" ); // Example message contents, this is required to be a MSISDN in the account the Key is registered to. // The maths of ($sig/2)+113 within the “sig” parameter inside the JSON is to convert signal strength from RSSI into DBM. You won’t need to do this if your devices report in DBM. // encode above params into JSON $jsonarray = json_encode($jsonarray); // api auth details $url = "https://platform.humanity.com/v1.0"; // build the parameters to be posted $post = "data=". $jsonarray; // intitate curl and send the request via POST $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $return = curl_exec($ch); //echo $return; print $return; ?>// Code end
Thanks,
Emir Kobaslic