Пример #1
0
<?php

include "config.php";
include "pdo.class.php";
include "functions.php";
if (isset($_POST['Body'])) {
    $phone = $_POST['From'];
    $order_id = strtolower($_POST['Body']);
    $status = order_lookup($order_id);
    print_sms_reply("Your order is currently set at status '" . $status . "'");
} else {
    print_sms_reply("Please send us your order id and we will look it up ASAP");
}
Пример #2
0
<?php

include "config.php";
$client = new Services_Twilio($accountsid, $authtoken);
include "functions.php";
if (isset($_POST['Body'])) {
    $sid = $_POST['SmsSid'];
    $phone = $_POST['From'];
    $phone = str_replace('+', '', $phone);
    $message = strtolower($_POST['Body']);
    $name = $people[$phone];
    if (empty($name)) {
        $name = $phone;
    }
    $message = '[' . $name . '] ' . $message;
    foreach ($people as $number => $name) {
        if ($number == $phone) {
            continue;
        }
        $sid = send_sms($number, $message);
    }
    print_sms_reply("Message delivered");
}
Пример #3
0
<?php

$results = find($from, $keywords);
$cnt = count($results->businesses);
$i = 1;
$reply = array();
foreach ($results->businesses as $business) {
    $business->name = str_replace(" & ", " and ", $business->name);
    $msg = $business->name . "\n" . $business->address1 . "\n" . $business->city . " " . $business->state . ", " . $business->zip;
    $reply[] = $msg;
    $i++;
}
print_sms_reply($reply);
function find($location, $query)
{
    $yelpql = "use 'http://github.com/spullara/yql-tables/raw/master/yelp/yelp.review.search.xml' as yelp; select * from yelp where term='" . $query . "' and location='" . $location . "' and ywsid='AMP_5mIt_VCZiw7xYK0DJw'";
    $result = getResultFromYQL($yelpql);
    return $result->query->results;
}
Пример #4
0
<?php

include "config.php";
include "pdo.class.php";
include "functions.php";
if (isset($_POST['Body'])) {
    $phone = $_POST['From'];
    $phone = str_replace('+', '', $phone);
    $message = strtolower($_POST['Body']);
    $sid = $_POST['SmsSid'];
    $now = time();
    $pdo = Db::singleton();
    $sql = "INSERT INTO messages SET `message`='{$message}', `phone_number`='{$phone}', `sms_sid`='{$sid}',`date`='{$now}'";
    $pdo->exec($sql);
    $msg = "Your message has been recorded";
    print_sms_reply($msg);
}
Пример #5
0
<?php

$movies = movies($from);
print_sms_reply($movies);
function movies($location)
{
    require_once 'simple_html_dom.php';
    $str = get_query('http://www.google.com/movies?near=' . urlencode($location));
    $html = str_get_html($str);
    $lines = array();
    foreach ($html->find('#movie_results .theater') as $div) {
        $i = 0;
        foreach ($div->find('.movie') as $movie) {
            $times = remEntities(strip_tags($movie->find('.times', 0)->innertext));
            $line = strip_tags($movie->find('.name a', 0)->innertext) . ' [ ' . $times . ' ] @ ' . strip_tags($div->find('h2 a', 0)->innertext);
            $lines[$line] = $line;
            $i++;
            if ($i == 10) {
                break;
            }
        }
        break;
    }
    $html->clear();
    return $lines;
}
Пример #6
0
include 'Services/Twilio.php';
include "config.php";
include "functions.php";
if (isset($_POST['Body'])) {
    $phone = $_POST['From'];
    $body = $_POST['Body'];
    $from = $_POST['FromCity'] . ', ' . $_POST['FromState'];
    $body = strtolower($body);
    $keywords = explode(" ", $body);
    $key = $keywords[0];
    unset($keywords[0]);
    $keywords = implode(" ", $keywords);
    if (file_exists("pages/" . $key . ".php")) {
        //	if a file matching this key exists in the pages folder.. For example: movies, weather, find, tv
        include "pages/" . $key . ".php";
    } else {
        $lines = array();
        $lines[] = "Hi, thanks for using local search. Please use the following keywords to perform your search.";
        $lines[] = "find 'keyword' to search for local businesses or restaurants";
        $lines[] = "movies to find local movies";
        $lines[] = "weather to get the local forecast";
        $lines[] = "tv to get the local tv listings and see what's on right now";
        $lines[] = "classifieds 'keyword' to search local classifieds";
        $lines[] = "search 'keyword' to search google";
        $lines[] = "stock 'stock symbol' to search the stock market";
        $lines[] = "news to return the latest headline news";
        print_sms_reply($lines);
    }
}
exit;
Пример #7
0
$key = 'Your API Key';
$zip = $_POST['FromZip'];
$cc = $_POST['FromCountry'];
//	Get the first TV service for this region:
$url = 'http://api.rovicorp.com/TVlistings/v9/listings/services/postalcode/' . $zip . '/info?locale=en-US&countrycode=' . $cc . '&apikey=' . $key . '&sig=sig';
$services = get_query($url);
$services = json_decode($services);
$services = $services->ServicesResult->Services->Service;
if (count($services)) {
    $sid = $services[0]->ServiceId;
    if (!empty($sid)) {
        $url = 'http://api.rovicorp.com/TVlistings/v9/listings/linearschedule/' . $sid . '/info?locale=en-US&duration=60&inprogress=true&apikey=' . $key . '&sig=sig';
        $whatson = get_query($url);
        $whatson = json_decode($whatson);
        #		echo '<pre>'.print_r($whatson,true).'</pre>';
        $whatson = $whatson->LinearScheduleResult->Schedule->Airings;
        $shows = array();
        $shows[] = "TV Shows starting in the next 60 minutes are:";
        $i = 0;
        foreach ($whatson as $show) {
            $shows[] = $show->Channel . ' - ' . $show->Title;
            $i++;
            if ($i == 10) {
                break;
            }
        }
        print_sms_reply($shows);
    }
} else {
    print_sms_reply('No shows were found for your region.');
}
Пример #8
0
<?php

include 'Services/Twilio.php';
include "config.php";
include "functions.php";
$client = new Services_Twilio($accountsid, $authtoken);
if (isset($_POST['Body'])) {
    header('Content-Type: text/html');
    $from = $_POST['From'];
    $body = $_POST['Body'];
    $msg = '[' . $from . '] ' . $body;
    $msg = substr($msg, 0, 160);
    send_sms($toNumber, $msg);
    print_sms_reply($canned);
}