Permalink
Browse files

dumping php stuff

  • Loading branch information...
1 parent 4544699 commit 1484989364daab3763c72a229684a938058fbd66 @claytantor claytantor committed Jan 27, 2013
Showing with 0 additions and 159 deletions.
  1. +0 −17 .project
  2. +0 −65 FiveOneOhEats.class.php
  3. +0 −8 index.php
  4. +0 −10 query.php
  5. +0 −44 smsrequest.php
  6. +0 −15 smstest.php
View
17 .project
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>510eat</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>net.sourceforge.phpeclipse.parserbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>net.sourceforge.phpeclipse.phpnature</nature>
- </natures>
-</projectDescription>
View
65 FiveOneOhEats.class.php
@@ -1,65 +0,0 @@
-<?php
-if (!class_exists('FiveOneOhEats')) {
-
- class FiveOneOhEats {
- const VERSON = '1.0';
-
-
- function get_results($query, $street_name){
- $json = $this->do_curl_get_https("https://data.acgov.org/api/views/3d5b-2rnz/rows.json?search="."$query"."&max_rows=25", $headers, $returnxfer = true);
- $result_data = json_decode($json);
- //print_r($result_data);
- $result = array();
- foreach ( $result_data->data as $row ) {
-
- $row_decoded = json_decode($row[12][0]);
- $search = sprintf("/%s/i",$street_name);
-
- $matched = preg_match($search, $row_decoded->address);
-
-
- if($matched){
- $result_line = array($row[8],$row[11],$row[9],$row_decoded);
- array_push($result,$result_line);
- }
-
- }
- return $result;
- }
-
- function do_curl_get_https($https_url, $headers) {
-
- //open connection
- $ch = curl_init();
-
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_CAINFO, NULL);
- curl_setopt($ch, CURLOPT_CAPATH, NULL);
-
- //set the url, number of POST vars, POST data
- curl_setopt($ch, CURLOPT_URL, $https_url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
- //execute post
- $result_json = curl_exec($ch);
-
- curl_close($ch);
-
- return $result_json;
-
- }
-
- function foo() {
- return "bar";
- }
-
-
-
- }
-
- global $fiveoneoheats;
- $fiveoneoheats = new FiveOneOhEats();
-}
-?>
View
8 index.php
@@ -1,8 +0,0 @@
-<?php
-/*
- * Created on Jul 21, 2012
- *
- * To change the template for this generated file go to
- * Window - Preferences - PHPeclipse - PHP - Code Templates
- */
-echo('hello 510 eat') ?>
View
10 query.php
@@ -1,10 +0,0 @@
-<?php
- include ("FiveOneOhEats.class.php");
- global $fiveoneoheats;
-?>
-<pre>
-<?php
- $result = $fiveoneoheats->get_results($_GET['query'], $_GET['street']);
- print_r($result);
-?>
-</pre>
View
44 smsrequest.php
@@ -1,44 +0,0 @@
-<?php
-include ("FiveOneOhEats.class.php");
-global $fiveoneoheats;
-
-
-// Allows me to debug!
-error_reporting(E_ALL);
-ini_set("display_errors",1);
-
-//setcookie("TestCookie", 'lolhi', time()+250); // Expires after 3-ish minutes
-$message='Something went wrong.'; // The final message to be sent
-$query = $_POST["Body"]; // The text body of the SMS message. Up to 160 characters long.
-$pieces = explode(',', $query, 2); // Split the query into two
-// echo "lol uh oh";
-$results = $$fiveoneoheats->get_results($pieces[0], $pieces[1]); // Pass in the data
-
-if(count($results)>-1) // Handles if there is more than one result (disabled for now)
-{
- if($state = 'MORE' && strcasecmp( 'MORE' , $query )==0) // Set back to QUERY after a MORE
- {
- $message=$results[0].' '.$results[1];
- }
- else //
- {
- $message=$results[0]." ".$results[1];
- }
-}
-
-if(count($results>=1))
-{
- $message=$results[0]." ".$results[1];
-}
-
-if(empty($result))
-{
- $message='No results found!';
-}
-
-header("content-type: text/xml");
-echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
-?>
-<Response>
- <sms><?php echo $message;?><?php if(count($results)>1) echo ' Text MORE for more results.'; ?></sms>
-</Response>
View
15 smstest.php
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<!-- Handmade with love by Adrian -->
-<head>
-<title>SMS tester</title>
-</head>
-<body>
-<form action="smsrequest.php" method="POST">
- Source number: <input type="text" name="From" value="+15551231234" /><br />
- Destination number: <input type="text" name="To" value="+14155551234" /><br />
- Message: <input type="text" name="Body" value="Taco Bell, Decoto" /><br />
- City (of the sending number): <input type="text" name="FromCity" value="Oakland, CA" /><br />
-
- <input type="submit" value="Submit" />
-</form>
-</body>

0 comments on commit 1484989

Please sign in to comment.