prova
Dependencies: mbed HTTPClient X_NUCLEO_IDW01M1v2 NetworkSocketAPI
Revision 13:4f05d2c04d96, committed 2019-03-04
- Comitter:
- carlotara
- Date:
- Mon Mar 04 18:00:52 2019 +0000
- Parent:
- 12:4ae87c278a63
- Commit message:
- prova
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4ae87c278a63 -r 4f05d2c04d96 main.cpp --- a/main.cpp Mon Jan 16 15:12:46 2017 +0000 +++ b/main.cpp Mon Mar 04 18:00:52 2019 +0000 @@ -38,7 +38,7 @@ SpwfSAInterface spwf(D8, D2, PC_12, PC_8, false); spwf.connect("STM","STMDemo", NSAPI_SECURITY_WPA2); - +// spwf.connect("","", NSAPI_SECURITY_WPA2); const char *ip = spwf.get_ip_address(); printf("\r\nIP Address is: %s\r\n", ip); @@ -90,7 +90,7 @@ //POST data HTTPMap map; HTTPText inText(str, 512); - map.put("Hello", "World"); + map.put("HelloRicevo", "World"); map.put("test", "1234"); printf("\nTrying to post data...\n\r"); ret = http.post("http://httpbin.org/post", map, &inText, HTTP_CLIENT_DEFAULT_TIMEOUT); @@ -121,6 +121,24 @@ printf("Error - ret = %d - HTTP return code = %d\n\r", ret, http.getHTTPResponseCode()); } + + //LETTURA DEI DATI + printf("\n\r"); + printf("Lettura Dati...\n\r"); + // ret = http.get("http://www.itirenatoelia.gov.it/allegati/hello4.html", str, 30, HTTP_CLIENT_DEFAULT_TIMEOUT); + ret = http.get("http://httpbin.org/get", str, 30, HTTP_CLIENT_DEFAULT_TIMEOUT); + + if (!ret) + { + printf("Dati Letti Con Successo - Letti %d Caratteri\n\r", strlen(str)); + printf("Risultato: %s\n\r", str); + } + else + { + printf("Errore - ret = %d - Codice Errore HTTP = %d\n\r", ret, http.getHTTPResponseCode()); + } + + //DELETE data //HTTPText inText(str, 512); printf("\nTrying to delete resource...\n\r");