Replace the line $path_to_script = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER[PHP_SELF]; with $path_to_script = "YOUR_SCRIPT_URL_HERE";