Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void testrequest()
- {
- WiFiClient client;
- char* host_loc = "192.168.0.110";
- int port_loc = 9091;
- if (!client.connect(host_loc, port_loc))
- {
- Serial.println("connection failed");
- return;
- }
- else
- {
- Serial.println("ok1");
- }
- String r =(String("PUT /metrics/job/myardujob HTTP/1.1\r\n")+
- "Accept-Encoding: identity\r\n"+
- //"Content-Length: 82\r\n"+
- "Host: "+host_loc+":"+port_loc+"\r\n"+
- "User-Agent: Python-urllib/3.10\r\n"+
- "Content-Type: text/plain; version=0.0.4; charset=utf-8\r\n"+
- "Connection: close\r\n"+
- "\r\n"+
- "# HELP my_metric descripion of a metric created by arduino\r\n"+
- "# TYPE my_metric gauge\r\n"+
- "my_metric 1337\r\n");
- client.print(r);
- Serial.println("ok2");
- while(1)
- {
- delay(1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment