hello i just made wordpress theme and want to use php script to authenticate my client domain, but it doesn't work. Here is script that running on client server (ex: client.com). $domain = $_SERVER['HTTP_HOST']; $data = file_get_contents('http://myserver.com/amasense.php'); $rows = explode("\n", $data); $verify = "false"; for($i = 0; $i < count($rows); $i++){ if($domain == $rows[$i]){ $verify = "true"; echo "<br/>"; echo "$verify -> ver<br/>"; echo "$domain -> dom<br/>"; echo "$rows[$i] -> rows<br/>"; dosomethinghere(); break; }else{ echo "<br/>"; echo "$verify -> ver<br/>"; echo "$domain -> dom<br/>"; echo "$rows[$i] -> row<br/>"; tellclienttoauthenticate(); } } PHP: and here is the content for amasense.php that running on my server othersite.com client.com anothersite.com PHP: my expected output the script will return $verify = "true" if its run on my client website (client.com). but above script will always return $verify as "false" even i run it on client.com server. is there something wrong with my code? or is there any ready to use script to do this thing? thank you very much for your help sir.
I believe $_SERVER[HTTP_HOST] returns "www.client.com" instead of the "client.com". I would say var_dump both $domain and $data and see if it really contains the desired value. Also remote URL access might be disabled by some hosting companies so you may need to warn that as well to the script user.