Error 302 Google Sheets PHP SDK -
i've been trying add listelements listfeed , it's working. problem after requests error message : error in google request (error code: 302). i've searched alot of places, couldn't find answer. here code :
//google initialization $client = new google_client(); $client->setclientid(gappid); $client->setclientsecret(gappsecret); $client->refreshtoken(gapprefreshtoken); $auth = $client->getaccesstoken(); $tokenresponse = json_decode($auth); $gtoken = $tokenresponse->access_token; //getting list feed $servicerequest = new defaultservicerequest($gtoken); servicerequestfactory::setinstance($servicerequest); $spreadsheetservice = new google\spreadsheet\spreadsheetservice(); $spreadsheetfeed = $spreadsheetservice->getspreadsheets(); $spreadsheet = $spreadsheetfeed->getbytitle($gconfig["spreadsheettitle"]); $worksheetfeed = $spreadsheet->getworksheets(); $worksheet = $worksheetfeed->getbytitle($gconfig["worksheettitle"]); $listfeed = $worksheet->getlistfeed(); //adding list elements sheet for($i = 0;$i <= 1000; $i++){ $listfeed->insert(array('col1header' => 'test')); }
do have idea error comes ? sheet api have limited no. requests/hour. still, doesn't makes sense if has limit cap, because when run script second time, still works until different point. assure configurated maximum execution time, won't problem.
what i've tried till now:
- using cellfeed instead of listfeed
- connecting api everytime insert list element (even refreshing access token , getting listfeed again).
none of work. behave same. here link sdk : https://github.com/asimlqt/php-google-spreadsheet-client
i hope me find solution.
thanks, andrei
Comments
Post a Comment