Skip to content

Instantly share code, notes, and snippets.

View duaneking's full-sized avatar
🏡
Working From Home. Code. Love. Defend.

Duane King duaneking

🏡
Working From Home. Code. Love. Defend.
View GitHub Profile
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
<?php
// minimal routing
function web_app($routes, $verb, $path) {
$verb = strtoupper($verb);
$path = trim(parse_url($path, PHP_URL_PATH), '/');
foreach ($routes as $route => $func) {
@list($req_verb, $req_path) = preg_split('/\s+/', $route, 2);