Guest User

Untitled

a guest
Apr 27th, 2016
8,242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function doGet(e) {
  2.   var output;
  3.   try
  4.   {
  5.     var query = e.parameter["q"];
  6.     var response = UrlFetchApp.fetch(decodeURIComponent(query));
  7.     output = {"result":"success", "response": JSON.parse(response.getContentText())};
  8.   }
  9.   catch(e)
  10.   {
  11.     output = {"result":"error", "error": "Unable to fetch"};
  12.   }
  13.   return ContentService.createTextOutput(JSON.stringify(output)).setMimeType(ContentService.MimeType.JSON);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment