mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 05:14:00 +02:00
Add current version of mbed code as stored at mbed.org
This commit is contained in:
parent
9a712ec12c
commit
ddb1399f9a
7 changed files with 155 additions and 1 deletions
23
mbed/request.cpp
Normal file
23
mbed/request.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "request.h"
|
||||
#include "HTTPClient.h"
|
||||
|
||||
HTTPClient http;
|
||||
static char url[40];
|
||||
|
||||
bool request(const char *arg, char *response) {
|
||||
if (!arg || strlen(arg) < 1) return false;
|
||||
|
||||
sprintf(url, "http://192.168.77.43:45678/code/%s", arg);
|
||||
//sprintf(url, "http://mbed.org/media/uploads/donatien/hello.txt");
|
||||
//sprintf(url, "http://192.168.77.141:3456/");
|
||||
|
||||
HTTPText text("text/plain");
|
||||
HTTPResult r = http.get(url, &text);
|
||||
if ( r == HTTP_OK ) {
|
||||
strncpy(response, text.gets(), 128);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue