Last active
October 5, 2020 13:16
-
-
Save av1m/7d8e9b3cafd85592d066b5e13e44a931 to your computer and use it in GitHub Desktop.
Sheety.co
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sheet = "coaching"; | |
$url = 'https://v2-api.sheety.co/1sddadce23170ca5d4718fd855qs8/testing/'.$sheet; | |
$data = array( | |
$sheet => array( | |
"name"=> htmlspecialchars($_POST["nom"]), | |
"mail"=> htmlspecialchars($_POST["mail"]), | |
)); | |
$options = array( | |
'http' => array( | |
'header' => "Content-type: application/x-www-form-urlencoded\r\nAuthorization: Bearer xHKXqsdsdsqGs3xhSk7R6784\r\n", | |
'method' => 'POST', | |
'content' => http_build_query($data) | |
)); | |
$context = stream_context_create($options); | |
$response = file_get_contents($url, false, $context); | |
if ($response === FALSE) { /* error */ } | |
$json_array = json_decode($response, true); | |
if (array_key_exists($sheet, $json_array)) { | |
echo "OK"; | |
} else { | |
echo "ERROR"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>Sheety</title> | |
<script src="https://code.jquery.com/jquery-latest.js"></script> | |
<script> | |
function submit_sheety(){ | |
var key_name = $("#name").val(); | |
var key_mail = $("#mail").val(); | |
var key_submit = $("#submit").val(); | |
$.post("form_post.php",{ | |
name:key_name, | |
mail:key_mail, | |
submit:key_submit | |
}, | |
function(data){ | |
$("#json_response").html(data); | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<center> | |
<h3>Sheety</h3> | |
<form> | |
<input type="text" name="name" id="name" placeholder="Enter your name ..." required> | |
<input type="mail" name="mail" id="mail" placeholder="Enter your mail ..." required> | |
<input type="button" value="Submit" onclick="submit_sheety()"/> | |
</form> | |
<br>----------- | |
<div id="json_response"></div> | |
</center> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment