Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created August 29, 2013 08:07
Show Gist options
  • Save phpfiddle/6375408 to your computer and use it in GitHub Desktop.
Save phpfiddle/6375408 to your computer and use it in GitHub Desktop.
nil no description
<?php function get_json_format($results){
//Format and return the result from the given json data
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
if(isset($_POST['query'])){
$results = json_decode(file_get_contents('http://sugg.in.search.yahoo.com/gossip-in/?output=json&l=1&command='.$_POST['query']));
$query_result = get_json_format($results);
?>
<table>
<tr><th>key</th><th>Mark</th></tr>
<?php
// Display the result data
?>
</table>
<?php
} else{
?>
<h3>My form</h3>
<form method="post">
<label>Search Text</label> <input type="text" value="" size="30" maxlength="100" name="query" /><br /><br />
<button id="mysubmit" type="submit">Submit</button><br /><br />
</form>
<?php
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment