Code: Select all
String Get_Location() {
HTTPClient http;
WiFiClientSecure calendarClientSecure;
//calendarClientSecure.setCACert(GOOGLE_CERT);
calendarClientSecure.setInsecure();
const char * headerKeys[] = {"Location"};
const size_t numberOfHeaders = sizeof(headerKeys) / sizeof(char*);
bool calendarBeginsOK = http.begin(calendarClientSecure,
F("script.google.com"),
443,
F("/macros/s/AKfycbwuHDmdhWbvgqK4cPUyFRCaznaifilgxLwT9J93Hb4xAYbCaPCMoze3GMUQKF1lGka4/exec"),
true);
Serial.printf("calendarBeginsOK: %d\n", calendarBeginsOK);
if (calendarBeginsOK == false) {
http.end();
return F("");
}
http.collectHeaders(headerKeys, numberOfHeaders);
http.setTimeout(15000);
int httpCode = http.GET();
Serial.printf("httpCode: %d\n", httpCode);
if (httpCode == HTTP_CODE_FOUND) { // 302
Serial.println( F("Found!") );
String httpHeader = http.header(0U).c_str();
Serial.printf("httpHeader\n%s\n", httpHeader.c_str());
/*
int indexFollowUpOK = httpHeader.indexOf("followup=") + 9;
Serial.printf("indexFollowUp: %d\n", indexFollowUpOK);
String realPath = httpHeader.substring(indexFollowUpOK);
Serial.printf("realPath\n%s\n", realPath.c_str());
*/
String realPathOK = urldecode(httpHeader);
Serial.printf("realPathOK\n%s\n", realPathOK.c_str());
http.end();
return realPathOK;
} // if (httpCode == HTTP_CODE_FOUND)
else
{
http.end();
return F("");
}
if (http.connected())
http.end();
return F("");
}
https://accounts.google.com/ServiceLogi ... lGka4/exec
what does it means?
i cannot request the same url.
Can you help me?
Thanks.
Marc.
