. insertRow() script 130 000 , 600 . 1.11.
, Zend HTTP POST Atom, , . Google .
, . $values , , . , $spreadsheetKey $worksheetId ( , , , , ).
$authService = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $authService);
function insertRow($httpClient, $spreadsheetKey, $worksheetId, $values) {
$entry = createEntry($values);
$httpClient->setUri("https://spreadsheets.google.com/feeds/list/".$spreadsheetKey."/".$worksheetId."/private/full");
$response = $httpClient->setRawData($entry, 'application/atom+xml')->request('POST');
return $response->getStatus() == 201;
}
function createEntry($values) {
$entry = "<entry xmlns=\"http://www.w3.org/2005/Atom\"";
$entry .= " xmlns:gsx=\"http://schemas.google.com/spreadsheets/2006/extended\">";
foreach($values as $key => $value) {
$entry .= "<gsx:".$key.">".$value."</gsx:".$key.">";
}
$entry .= "</entry>";
return $entry;
}
, .