<?php require './resources/passgen.php'; define('__apiURL__', 'http://randomword.setgetgo.com/get.php'); $testAPI = function ($apiURL) { $api = new SimpleHttpGetRequest(); $api->setURL($apiURL); return $api->get() && $api->getStatus() === 200; }; $passGen; $passWord; $showApiError; if ($testAPI(__apiURL__)) { $showApiError = false; $passGen = new PasswordGenerator($_GET); $passGen->setWordApiURL(__apiURL__); $passWord = $passGen->generate(); } else { $showApiError = true; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Project 2</title> <!-- Bootstrap 3.3.5 --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">