This is my first time posting here! :) I have made a php license generation and validation system. The server end communicates with the mysql database and outputs a json result like the following:
{"valid":"true","info":{"id":"1","expire":"1421811123"}}
The problem is on the client server where i have the following script:
<?php
$key_info['key'] = "KEY"];
$serverurl = "http://URLTOSERVER";
$ch = curl_init ($serverurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $key_info);
$result = curl_exec ($ch);
$result = json_decode($result, true);
if($result['valid'] == true){
echo "valid";
}
else {
die("Invalid Key!");
}
?>
When i run this i get "valid" every time, even when i enter the wrong key - i have tried printing the output and i can confirm that.
Please advise.
Thanks.