Skip to content

Instantly share code, notes, and snippets.

@dwatrous
Created October 19, 2016 17:05
Show Gist options
  • Save dwatrous/382adf705ea65d6380ab7eec936a250a to your computer and use it in GitHub Desktop.
Save dwatrous/382adf705ea65d6380ab7eec936a250a to your computer and use it in GitHub Desktop.
<?php
$services = json_decode(getenv("VCAP_SERVICES"), true);
$host = $services['user-provided'][0]['credentials']['alsechohost'];
echo "Host from environment: $host";
if (isset($_GET['whatisaid'])) {
$ch = curl_init("http://$host/echo.php?message=".$_GET['whatisaid']);
curl_setopt($ch, CURLOPT_HEADER, 0);
$response = curl_exec($ch);
curl_close($ch);
}
?>
<html>
<head>
<title>Speak and Echo</title>
</head>
<body>
<form>
What you want to say: <input type="text" name="whatisaid">
<input type="submit" value="Say it">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment