Skip to content

Instantly share code, notes, and snippets.

View caseysoftware's full-sized avatar

Danger Casey caseysoftware

View GitHub Profile
@caseysoftware
caseysoftware / gist:6798365
Created October 2, 2013 18:32
Snippet to show requesting the message body
<?php
//This is a partial snippet
$contextIO = new ContextIO($consumerKey, $consumerSecret);
//use the message id to get the message body
$message = $contextIO->getMessageBody($account_id,
array('message_id' => $message_id, 'type' => 'text/plain'));
if (is_object($message)) {
$content = $message->getData();
@caseysoftware
caseysoftware / rev3.php
Last active December 24, 2015 12:39
This file accepts the incoming webhook request and uses it to retrieve the message_id to create the TwiML url.
<?php
include 'credentials.php';
require 'vendor/Services/Twilio.php';
$json = file_get_contents('php://input');
$data = json_decode($json);
$message_id = $data->message_data->message_id;
@caseysoftware
caseysoftware / rev3-readbody.php
Created October 2, 2013 19:11
This uses the message_id received from the last step to retrieve the message body and then generates TwiML to Say the message.
<?php
include 'credentials.php';
require 'vendor/Services/Twilio.php';
require 'vendor/PHP-ContextIO/class.contextio.php';
$message_id = $_GET['message_id'];
$contextIO = new ContextIO($consumerKey, $consumerSecret);
@caseysoftware
caseysoftware / rev4-navigate.php
Last active December 24, 2015 12:39
Replaces the original say commands with the gather commands
<?php
// this is just a snippet, not the full file
// create the body of the Twiml
$response = new Services_Twilio_Twiml();
$gather = $response->gather(array('numDigits' => 1, 'action' => 'rev4-process.php?message_id=' . $message_id));
$gather->say("Press 7 at any time to delete this message.");
$gather->say($welcome);
$gather->say("Here's the message");
$gather->say($body);
@caseysoftware
caseysoftware / rev4-process.php
Created October 2, 2013 20:01
Process the input of the gather statement
<?php
include 'credentials.php';
require 'vendor/Services/Twilio.php';
$digits = (int) $_POST['Digits'];
$message_id = $_GET['message_id'];
$contextIO = new ContextIO($consumerKey, $consumerSecret);
<?php
// This includes our public and private keys
include_once 'creds.php';
// This includes the base of our library, everything else is
// autoloaded according to the PSRs.
include_once 'vendor/autoload.php';
// First initiatialize the Marvel client object, it does all the heavy lifting.
$client = new \Marvel\Client($public_key, $private_key);

Keybase proof

I hereby claim:

  • I am caseysoftware on github.
  • I am caseysoftware (https://keybase.io/caseysoftware) on keybase.
  • I have a public key whose fingerprint is 4F92 F62D 4B7B 1D12 83ED 332F 9A97 08A6 9D90 E5FD

To claim this, I am signing this object:

@caseysoftware
caseysoftware / composer.json
Created May 14, 2014 22:04
Composer file to install the helper library
{
"require": {
"op3nvoice/op3nvoice-helper": "dev-master"
}
}
@caseysoftware
caseysoftware / retrieve.php
Created May 14, 2014 22:10
Script for parsing the RSS feed and loading the videos into OP3Nvoice, the full project is available here: https://github.com/caseysoftware/op3nvoice-austin-city-govt
<?php
require 'creds.php';
require 'vendor/autoload.php';
/**
* The code to parse the namespaces was derived from http://blog.sherifmansour.com/?p=302
*/
$rssFeed = 'http://austintx.swagit.com/videos.xml';
$rssString = file_get_contents($rssFeed);
@caseysoftware
caseysoftware / list.php
Last active August 29, 2015 14:01
Script to list all the file currently loaded, the full project is available here: https://github.com/caseysoftware/op3nvoice-austin-city-govt
<?php
require 'creds.php';
require 'vendor/autoload.php';
$video = new OP3Nvoice\Bundle($apikey);
$items = $video->index();
foreach($items as $item) {