Skip to content

Instantly share code, notes, and snippets.

View tjlytle's full-sized avatar

Tim Lytle tjlytle

View GitHub Profile

Hands On API Design

Tutorial Requirements

Don't stress over this. Even if you come without a laptop, you should be able to learn from the tutorial.

  • A laptop with an internet connection, pen, and paper will be all that’s needed to activly participate in most of the tutorial.
  • If you want to follow along during the coding, any modern(5.3+) PHP development environment will work.
<?php
if (!isset($_POST['msisdn'], $_POST['to'], $_POST['text'])) {
return; // not a nexmo request
}
if ("yes" === strtolower(substr($_POST['text'], 0, 3))) {
// here's where you need to do something to store the inbound phone number
error_log('got message from: ' . $_POST['msisdn']);
// reply with the message (this is a bit hacky, but should work anywhere)
<?php
require_once __DIR__ . '/vendor/autoload.php';
$client = new \Nexmo\Client(new \Nexmo\Client\Credentials\Basic(NEXMO_KEY, NEXMO_SECRET));
try {
$inbound = \Nexmo\Message\InboundMessage::createFromGlobals();
} catch (Exception $e) {
error_log('could not parse inbound message');
}
<html>
<head/>
<body>
<a target="_blank" href='chrome-extension://maldgfaihandkckmgabpbkgnjbafnbog/settings.html'>Configure Extension</a>
</body>
</html>
<?php
$limit = 1000000;
$counts = [
'1' => 0,
'2' => 0,
'3' => 0,
'4' => 0,
'5' => 0,
'6' => 0,
'7' => 0,