I’m trying to make some sort of communication between two servers(can be called license verification).
Already got this:
index.php
if ($verification == 1) {
echo "license validated";
}
else {
echo "this license key does not exist.";
}
validate.php
$license_key = mysql_real_escape_string($_GET['license_key']);
$query = "SELECT license_key FROM users WHERE license_key = '$license_key'";
$mysqli = new mysqli();
$mysqli->connect($db_hostname, $db_username, $db_password, $db_name);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli->connect_error;
}
$result = $mysqli->query($query);
$row_cnt = $result->num_rows;
if ($row_cnt == 1) {
return true;
}
else {
return false;
}
What I can’t figure out is how to send that request from index.php to validate.php ( this 2 files are not in same server ) and how to get back to index.php information what it returns (true or false).
Use file_get_contents: