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

include 'includes/clientlogin.php';
include 'includes/sql.php';
include 'includes/file.php';
// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array("accountType" => "HOSTED_OR_GOOGLE", "Email" => "*****@*****.**", "Passwd" => "Moloko6+7", "service" => "fusiontables", "source" => "your application name");
// Initialize the curl object
$curl = curl_init($clientlogin_url);
// Set some options (some for SHTTP)
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $clientlogin_post);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// Execute
$response = curl_exec($curl);
// Get the Auth string and save it
preg_match("/Auth=([a-z0-9_\\-]+)/i", $response, $matches);
$auth = $matches[1];
echo "The auth string is: " . $auth;
$ftclient = new FTClientLogin($auth);
//show all tables
echo $ftclient->query(SQLBuilder::showTables());
echo "<br />";
//describe a table
echo $ftclient->query(SQLBuilder::describeTable(674831));
echo "<br />";
//insert into table (test, test2, 'another test') values (12, 3.3333, 'bob')
echo $ftclient->query(SQLBuilder::insert(674831, array('AgendaDate' => 'May 11, 2001', 'AgendaItem' => 'JPA Bridge', 'Presenter' => 'Hardy Whitten', 'URL' => 'http://www.google.com')));
<?php

include '../clientlogin.php';
include '../sql.php';
include '../file.php';
//get token
$token = ClientLogin::getAuthToken('username', 'password');
$ftclient = new FTClientLogin($token);
//show all tables
echo $ftclient->query(SQLBuilder::showTables());
echo "<br />";
//describe a table
echo $ftclient->query(SQLBuilder::describeTable(358077));
echo "<br />";
//select * from table
echo $ftclient->query(SQLBuilder::select(358077));
echo "<br />";
//select * from table where test=1
echo $ftclient->query(SQLBuilder::select(358077, null, "'test'=1"));
echo "<br />";
//select test from table where test = 1
echo $ftclient->query(SQLBuilder::select(358077, array('test'), "'test'=1"));
echo "<br />";
//select rowid from table
echo $ftclient->query(SQLBuilder::select(358077, array('rowid')));
echo "<br />";
//delete row 401
echo $ftclient->query(SQLBuilder::delete(358077, '401'));
echo "<br />";
//drop table
echo $ftclient->query(SQLBuilder::dropTable(358731));
<html>

<?php 
//include the files from the PHP FT client library
include 'fusion-tables-client-php/clientlogin.php';
include 'fusion-tables-client-php/sql.php';
include 'fusion-tables-client-php/file.php';
// Table id
$tableid = 750563;
//Enter your username and password
$username = "******";
$password = "******";
// Get auth token - it would be better to save the token in a secure database
// rather than requesting it with every page load.
$token = ClientLogin::getAuthToken($username, $password);
$ftclient = new FTClientLogin($token);
// If the request is a post, insert the data into the table
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Insert form data into table
    $insertresults = $ftclient->query(SQLBuilder::insert($tableid, array('Name' => $_POST['name'], 'Value' => $_POST['result'], 'Location' => $_POST['location'], 'Timestamp' => time())));
    $insertresults = explode("\n", $insertresults);
    $rowid1 = $insertresults[1];
}
?>

<head>
<title>Simple Form Example</title>

<style>
  body { font-family: Arial, sans-serif; }
  #map_canvas { height: 300px; width:400px; }
Пример #4
0
<?php

include 'includes/clientlogin.php';
include 'includes/sql.php';
include 'includes/file.php';
echo "got here";
//get token
$token = ClientLogin::getAuthToken('*****@*****.**', 'Moloko6+7');
$ftclient = new FTClientLogin($token);
//show all tables
echo $ftclient->query(SQLBuilder::showTables());
echo "<br />";
/*
//describe a table
echo $ftclient->query(SQLBuilder::describeTable(358077));
echo "<br />";
//select * from table
echo $ftclient->query(SQLBuilder::select(358077));
echo "<br />";
//select * from table where test=1
echo $ftclient->query(SQLBuilder::select(358077, null, "'test'=1"));
echo "<br />";
//select test from table where test = 1
echo $ftclient->query(SQLBuilder::select(358077, array('test'), "'test'=1"));
echo "<br />";
//select rowid from table
echo $ftclient->query(SQLBuilder::select(358077, array('rowid')));
echo "<br />";
//delete row 401
echo $ftclient->query(SQLBuilder::delete(358077, '401'));
echo "<br />";
Пример #5
0
 * Date: 5/2/2012
 * 
 */
include 'source/clientlogin.php';
include 'source/sql.php';
include 'source/connectioninfo.php';
function format_address($street, $city, $state, $zip)
{
    $result = str_replace(" ", "&nbsp;", $street);
    $result = $result . "<br />{$city}, {$state} {$zip}";
    return $result;
}
//phpinfo();
//get token
$token = ClientLogin::getAuthToken(ConnectionInfo::$google_username, ConnectionInfo::$google_password);
$ftclient = new FTClientLogin($token);
//select * from table
$result = $ftclient->query(SQLBuilder::select(ConnectionInfo::$fusionTableId));
?>

<!DOCTYPE html>
<html>
<head>
	<title>Health Clinics in Chicago - Full List</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	
	<link href='styles/master.css' media='all' rel='stylesheet' type='text/css' />
	
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> 
	<!--<script src="/source/analytics_lib.js" type="text/javascript"></script>-->
	<script src="source/jquery.dataTables.min.js" type="text/javascript"></script>