Google Apps ScriptでBasic認証のページにPOSTする

function doPost() {
  // アクセス先の情報
  var url = "http://";
  var userid = "id";
  var password = "password";

  // POSTメソッドの投稿データ
  var payload = {
    "key1" : "value1",
    "key2" : "value2"
  }

  // POSTメソッドのオプション
  var options = {
    "method" : "POST",
    "headers" : {"Authorization" : " Basic " + Utilities.base64Encode(userid + ":" + password)},
    "payload" : payload,
    "muteHttpExceptions" : true
  }

  try{
    // POSTメソッドのリクエスト
    var response = UrlFetchApp.fetch(url, options);
    var content = response.getContentText("UTF-8");
  }catch(e){
    Logger.log(e.message);
  }
}