Advertisement
MrDxdiag

BOT VISITOR

Apr 15th, 2015
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function cronExecute() {
  2.  
  3. var url = "http://diiedha.my.id/v/index.php?a=b";
  4.  
  5. var options = {
  6. "method" : "get",
  7. "headers" : {'User-Agent' : 'Mozilla Firefox 14.0',
  8.              'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
  9.             },
  10. "payload" : "",
  11. "contentType" : "application/xml; charset=utf-8"
  12. };
  13.  
  14. var request_starttime = new Date();
  15. // fetch the HTTP / HTTPS request and get the response
  16. var response = UrlFetchApp.fetch(url,options);
  17. var request_endtime = new Date();
  18.  
  19. // use any spreadsheet, use its key
  20. // var ss = SpreadsheetApp.openById("KEY-SHEET");
  21. // use this script's default spreadsheet
  22. var ss = SpreadsheetApp.getActiveSpreadsheet();
  23. // get the worksheet
  24. var sheet = ss.getSheets()[0];
  25.  
  26. // inserting values into the sheet
  27. sheet.insertRowBefore(1);
  28. var colValues = [[ request_starttime, request_endtime,
  29.                  response.getResponseCode(), response.getHeaders().toSource(),
  30.                  url, response.getContentText() ]];
  31. sheet.getRange(1, 1, 1, 6).setValues(colValues);
  32.  
  33. // if something is not working, use the Logger object/function (uncomment it and modify it)
  34. // Logger.log(ss.getSpreadsheetTimeZone());
  35.  
  36. // view the log details from VIEW -> LOGS
  37.  
  38. // You can also RUN the script and view its Execution log
  39. // try this VIEW -> EXECUTION TRANSCRIPTS
  40.  
  41. // Make sure you MODIFY and then RUN the script and
  42. // verify its working OK by looking at the spreadsheet contents
  43. // try this RUN -> CRONEXECUTE
  44. // check the spreadsheet contents
  45.  
  46. // After its working OK, you should setup a TRIGGER to execute it as and when you want (frequency)
  47. // try this TRIGGERS -> ALL YOUR TRIGGERS
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement