zend google fusion table update

荒凉一梦 提交于 2019-12-02 14:01:33

问题


As anyone any idea on how to update a table in google fusion using Zend framework?

I can get the data:

$url = "https://www.google.com/fusiontables/api/query?sql=SELECT%20name%20FROM%201695591";
$data = $gdata->get($url);

$postcodes = $data->getRawBody();

But have no idea how to update a row ... I know I have to 'call' this url, but no idea how :

UPDATE table_id SET column_name = value {, column_name = value }* WHERE ROWID = row_id

Thank you


回答1:


Try this class http://barahlo.semero.com/description/Zend_Gdata_Fusion.zip

Example of usage:

$client = Zend_Gdata_ClientLogin::getHttpClient('your_login_here@gmail.com', 'your_pass_here', 'fusiontables');

$base = new Zend_Gdata_Fusion($client);


$sql = "SELECT ROWID FROM 596524 WHERE id = 1;";
$rowdata =  $base->query($sql)->get_array();
print_r($rowdata);

$newRowId = $base->insertRow('596524',array(
    'id' => time(),
    'name' => 'trird row',
    'added' => date('n/j/y'),
) );

$base->updateRow(
    '596524', 
    array('name' => 'new first row'), 
    $rowdata[1][0] //ROWID from insert query
);

Oauth login for Zend_Gdata:

$oauthOptions = array( 
'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER, 
'version' => '1.0', 
'signatureMethod' => 'HMAC-SHA1', 
'consumerKey' => $CONSUMER_KEY, 
'consumerSecret' => $CONSUMER_SECRET 
); 

$consumer = new Zend_Oauth_Consumer($oauthOptions); 
$token = new Zend_Oauth_Token_Access(); 
$client = $token->getHttpClient($oauthOptions,null);

$base = new Zend_Gdata_Fusion($client);

// ...

Also, there is official php client library http://code.google.com/p/fusion-tables-client-php/



来源:https://stackoverflow.com/questions/7625945/zend-google-fusion-table-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!