I used this code but I get always empty result I don't know why
if (isset($_POST['uname'], $_POST['password'])){
$uname = test_input($_POST['uname']);
$pw = test_input($_POST['password']);
$data = array(
"loginEmail" => $uname,
"loginPassword" => $pw,
"clientURI" => "https://hk2.notify.windows.com/?token=AwYAAAC2bng45wHDpXWajWLTxGM1gxP1DcLlHTL8%2bhOfKVbkpYjl1U9tnUGrW4FSmwuiiWPKEyvSUoO5v9nfzFWZ097kdUeN8xDpAlp96Ilk3LCSN0sQNFuyU%3d"
);
$url_send ="https://dev-frontserver.com/api/login";
$str_data = json_encode($data);
$headers = array("Content-Type: application/json");
function sendPostData($url, $post, $headers){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
echo "result = " .sendPostData($url_send, $str_data, $headers);*/
}
Any idea what is wrong with my code ? I tried the api in https://www.hurl.it and it work but I can not get it to work in my code.
Here are the returned data from `curl_getinfo($ch);'
array (size=26)
'url' => string 'https://dev-fronapp.com/api/login' (length=47)
'content_type' => string 'application/json; charset=utf-8' (length=31)
'http_code' => int 200
'header_size' => int 268
'request_size' => int 384
'filetime' => int -1
'ssl_verify_result' => int 20
'redirect_count' => int 0
'total_time' => float 2.14
'namelookup_time' => float 0
'connect_time' => float 0.344
'pretransfer_time' => float 1.047
'size_upload' => float 253
'size_download' => float 3991
'speed_download' => float 1864
'speed_upload' => float 118
'download_content_length' => float 3991
'upload_content_length' => float 253
'starttransfer_time' => float 2.125
'redirect_time' => float 0
'redirect_url' => string '' (length=0)
'primary_ip' => string '' (length=13)
'certinfo' =>
array (size=0)
empty
'primary_port' => int 443
'local_ip' => string '' (length=12)
'local_port' => int 10484