Maybe ESP8266HTTPClient was a big dead-end for me.
Following How the read a website-content with ESP8266 ? - #4 by tolga121, I've used client.print(). Now I can get return code 1, but the output is just 3 blank lines. Here is setup(){ }, with the same headers and macros as before:
void
setup()
{
char serverName[100];
char request[200];
int httpCode;
String line;
u8g2.begin();
u8g2.setFont(FONT);
NEWSCREEN(0);
get_wifi();
NEWSCREEN(0);
sprintf(serverName,"icanhazip.com");
httpCode = client.connect(serverName,80);
WRITE_LINE("%d:%s", httpCode,serverName);
sprintf(request,
"GET / HTTP/1.1\r\n"
"Host: %s\r\n"
"User-Agent: ESP8266/NodeMCU 0.9\r\n"
"Accept: */*\r\n",
serverName);
client.print(request);
WRITE_LINE("have printed request");
while(client.connected()){
WRITE_LINE("connected");
line = client.readStringUntil('\r');
WRITE_LINE("%s",line);
}
WRITE_LINE("endo");
delay(20000);
}
By the way, I've tried to follow the advice in arduino - Request cURL with ESP8266 - Stack Overflow to get the GET parameters (headers, maybe?) from "curl -v [url]".