Skip to content

Instantly share code, notes, and snippets.

Avatar
🤡
Cranking Out The Code

Andrew Watson andrewwatson

🤡
Cranking Out The Code
View GitHub Profile
@andrewwatson
andrewwatson / fetchContact.xml
Created Feb 19, 2012
InfusionSoft Load Contact XMLRPC Response
View fetchContact.xml
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>LastUpdatedBy</name>
<value>
<i4>-1</i4>
View User.php
// models/User.php
/**
* Check if the user used the domain prefix
* to login. If they did pass param through
* unchanged. If they didn't, prepend it and
* return it.
* @param string $username
* @return string
*/
@andrewwatson
andrewwatson / nuance.php
Created Nov 11, 2011
Example Nuance Integration
View nuance.php
<?php
$headers = array(
"X-Language: en-US",
"X-Service: FullAuto",
"X-Reference: voicecloud-reference-123",
"Content-Type: audio/wav",
"Content-Transfer-Encoding: base64",
"Content-Length: " . filesize("test2.64.wav")
);
View chatter2.py
#!/usr/bin/python
import sys
from chatterbotapi import ChatterBotFactory, ChatterBotType
factory = ChatterBotFactory()
bot1 = factory.create(ChatterBotType.CLEVERBOT)
bot1session = bot1.create_session()
@andrewwatson
andrewwatson / test.php
Created Jul 19, 2011
multiple cookies
View test.php
<?php
if (isset($_COOKIE['one'])) {
$new_one = $_COOKIE['one'] += 1;
$new_two = $_COOKIE['two'] += 1;
setcookie('one', $new_one);
setcookie('two', $new_two);
$response = "One says " . $new_one . " but Two says ". $new_two;
} else {
setcookie('one', 1);
@andrewwatson
andrewwatson / sms.php
Created Jun 30, 2011
Call me and Read Me A Text
View sms.php
<?php
// Where I define my credentials in AccountSid and AuthToken
include("../config.inc");
// Twilio Helper Library
include("twilio.php");
$what = $_POST['Body'];
View secret.php
<?php
header("Content-type: text/xml");
if ($_POST['Digits'] == "12345") {
$response = '
<Say>That is Correct</Say>
<Gather action="send.php" numDigits="10">
<Say>Type the number of the person to message</Say>
</Gather>
';
View saystuff.xml
<Response>
<Say>I am a man. This is how I talk. 1 2 3 4. Skippy Dippy Waffle Sauce.</Say>
<Pause length="1" />
<Say voice="woman">I am a woman. I have a much nicer voice than that man.</Say>
<Pause length="1" />
<Say language="es">Por favor, manténgase alejado de las puertas</Say>
</Response>
View setURL.php
<?php
$sn = $argv[1];
$asid = $argv[2];
$vurl = $argv[3];
$sid = "ACxxxxxxxxxxxxxxxxxxxx";
$token = "xxxxxxxxxxxxxxx";
@andrewwatson
andrewwatson / upgrade.php
Created Jun 8, 2011
Upgrade Phone Number
View upgrade.php
<?php
$sn = $argv[1];
$asid = $argv[2];
$sid = "ACxxxxx";
$token = "xxxxx";
$url = "https://api.twilio.com/2010-04-01/Accounts/${asid}/IncomingPhoneNumbers/${sn}";
printf("%s\n",$url);