I realized that allowing external access is not an option due to the volume of sites that will be running off of the parent site. I will not want to be manually allowing that many external IP connections. So, I think I will need to do the API.
Here is my child site class that will be sending the request:
public function siteCheck() {
if ($result = TRUE) {
return TRUE;
}
die('Your website is not valid!');
}
Here is the parent file that will be receiving the request and returning the response:
<?php
// Get the URL
$url = '';
// Break it apart in paramters.
$parameters = '';
// Query the site table based on the paramteres.
$query = $database->prepare("SELECT * FROM site WHERE site_name = ? AND site_url = ? AND site_token = ? AND site_active = 1");
$query->execute(array($name, $url, $token));
$result = $query->fetch(PDO::FETCH_ASSOC);
if ($result[''] == 1) {
$response = '';
} else {
$response = '';
}
// If one entry was found then the site is valid.
// Encode the result.
My question is, how do I properly code this piece of functionality? Thanks!