NetBurner 3.5.0
PDF Version
 
Web Client

Topics

 Web Client Error Codes
 

Classes

class  ParsedURI
 Parsed Uniform Resource Identifier Class (URI) More...
 

Functions

void SetHttpDiag (bool b)
 Enable/disable Web Client HTTP diagnostics to the console port.
 
int DoMultipartStartPost (ParsedURI &TheUri, const char *separator, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND, uint32_t contentLength=0)
 Start a multipart HTTP post using a pre-parsed URI object.
 
int DoMultipartStartPost (const char *pUrl, const char *separator, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND, uint32_t contentLength=0)
 Start a multipart HTTP post using a pointer to a URL.
 
void DoMultipartItem (int tcpfd, const char *Disposition, const char *separator, const unsigned char *data, int len)
 Send a multipart item.
 
void DoMultipartBoundary (int tcpfd, const char *Disposition, const char *separator)
 Send a multipart boundary.
 
bool DoMultipartFinished (int tcpfd, const char *separator, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Send a multipart item.
 
bool DoUrlEncodedFormPost (ParsedURI &TheUri, char *headers, char *form_data, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT)
 Post a JSON file using a HTTP Form Post and a a ParsedURI object.
 
bool DoUrlEncodedFormPost (const char *pUrl, char *headers, char *form_data, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT)
 Post a JSON file using a HTTP POST and a URL string and pointer to JSON data.
 
bool DoJsonPost (const char *pUrl, const char *Json_Data_To_Post, buffer_object &result_buffer, const char *AdditionalHeaders=NULL, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Post a JSON file using a HTTP POST and a URL string and pointer to JSON data.
 
bool DoJsonPost (ParsedURI &TheUri, const char *Json_Data_To_Post, buffer_object &result_buffer, const char *AdditionalHeaders=NULL, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Post a JSON file using a HTTP POST and a ParsedURI object.
 
bool DoJsonPost (const char *pUrl, ParsedJsonDataSet &jsonout, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Post a JSON file using a HTTP POST and a URL string.
 
bool DoJsonPost (ParsedURI &TheUri, ParsedJsonDataSet &jsonout, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Post a JSON file using HTTP and a ParsedURI object.
 
bool DoJsonPostHttpFile (const char *pUrl, const char *FragmentName, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Post a JSON file using HTTP and a URL string.
 
bool DoJsonPostHttpFile (ParsedURI &TheUri, const char *FragmentName, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Post a JSON file using HTTP and a ParsedURI object.
 
bool DoGet (ParsedURI &TheUri, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 
bool DoGetEx (ParsedURI &TheUri, const char *headers, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 
bool DoGet (const char *pUrl, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a HTTP/HTTPS GET request using a pointer to a URL string.
 
bool DoGetEx (const char *pUrl, const char *headers, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a HTTP/HTTPS GET request using a pointer to a URL string.
 
int DoGet (ParsedURI &TheUri, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI)
 
int DoGetEx (ParsedURI &TheUri, const char *headers, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI)
 
int DoGet (const char *pUrl, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a HTTP/HTTPS GET request using a pointer to a URL string.
 
int DoGetEx (const char *pUrl, const char *headers, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a HTTP/HTTPS GET request using a pointer to a URL string.
 
int DoGetUpdate (ParsedURI &TheUri, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a firmware update from the specified URI.
 
int DoGetUpdate (const char *pUrl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)
 Execute a firmware update from the specified URI.
 
int PopulateAuthHeader (const char *user, const char *password, char *buffer, int maxlen)
 Fill in a username and password into a buffer for use as an extra header.
 
bool DoActualClientRequest (ParsedURI &TheUri, uint16_t &next_time_delay)
 Callback to specify for performing and handle a WebClient request.
 
bool StartWebClient (int prio, const char *url1, const char *url2=NULL, bool bDoNtp=false)
 Start the web client using a URL string.
 
bool StartWebClient (int prio, const NBString &url1, const NBString &url2, bool bDoNtp=false)
 Start the web client using a NBString.
 
bool StartWebClient (int prio, const NBString &url1, bool bDoNtp=false)
 Start the web client using a NBString.
 

Variables

WebErrorReporterFunc * pWebErrorReporter
 Set this variable to a callback function to specify a handler for errors.
 

Detailed Description

#include< http_funcs.h >

Functions for interacting with the web, like HTTP GET/POST requests.

An easy way to get web data (from our GetNonJsonFromServer example):
const char *purl = "http://www.example.com/";
int result = 0;
static unsigned char ResultBuffer[5000];
result = DoGet(purl, ResultBuffer, 5000, 60 * TICKS_PER_SECOND);
if (result > 0)
{
printf("Result = %d\r\n[", result);
for (int i = 0; i < result; i++)
{
printf("%c", ResultBuffer[i]);
}
printf("]\r\n");
}
else
{
iprintf("Failed to contact server\r\n");
}
#define TICKS_PER_SECOND
System clock ticks per second.
Definition nbrtos/include/constants.h:41
bool DoGet(ParsedURI &TheUri, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND)

#include< web_client.h >

Functions for instantiating a periodic web client

From our WebClient examples:
const char *url = "http://www.example.com";
void HandleErrorState(int state)
{
if (state == WEB_CLIENT_ERROR_NO_ERROR) return;
if ((state <= WEB_CLIENT_ERROR_LAST_STATE) && (state > 0))
iprintf("Set Error state [%d] [%s]\r\n", state, web_error_state_text[state]);
else
iprintf("Error state unknown %d\r\n", state);
}
bool DoActualClientRequest(ParsedURI &TheUri, uint16_t &next_time_delay)
{
static unsigned char ResultBuffer[5000];
bool result = DoGet(TheUri, ResultBuffer);
if (result)
{
printf("Result = %d\r\n[", result);
for (int i = 0; i < result; i++)
{
printf("%c", ResultBuffer[i]);
}
printf("]\r\n");
next_time_delay = 10 * TICKS_PER_SECOND;
return true;
}
next_time_delay = 10 * TICKS_PER_SECOND;
return false;
}
void UserMain(void *pd)
{
init();
pWebErrorReporter = HandleErrorState;
while (1)
{
}
}
Parsed Uniform Resource Identifier Class (URI)
Definition http_funcs.h:62
#define MAIN_PRIO
Recommend UserMain priority.
Definition nbrtos/include/constants.h:97
void OSTimeDly(uint32_t to_count)
Delay the task until the specified value of the system timer ticks. The number of system ticks per se...
Definition nbrtos.h:1732
bool StartWebClient(int prio, const char *url1, const char *url2=NULL, bool bDoNtp=false)
Start the web client using a URL string.
bool DoActualClientRequest(ParsedURI &TheUri, uint16_t &next_time_delay)
Callback to specify for performing and handle a WebClient request.
Definition WebClient/FindMyIpTask/src/main.cpp:26
void init()
System initialization. Ideally called at the beginning of all applications, since the easiest Recover...
bool WaitForActiveNetwork(uint32_t ticks_to_wait=120 *TICKS_PER_SECOND, int interface=-1)
Wait for an active network connection on at least one interface.
#define WEB_CLIENT_ERROR_NO_ERROR
No error.
Definition web_client.h:86

Function Documentation

◆ DoActualClientRequest()

bool DoActualClientRequest ( ParsedURI & TheUri,
uint16_t & next_time_delay )

#include <web_client.h>

Callback to specify for performing and handle a WebClient request.

Parameters
TheUriPointer to a ParsedURI object (representing the URL)
next_time_delayPointer to the number of ticks to wait before the next request
Returns
True on success, false on failure.

◆ DoGet() [1/4]

bool DoGet ( const char * pUrl,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a HTTP/HTTPS GET request using a pointer to a URL string.

This function will parse the URL string to connect to the host.

Parameters
pUrlPointer to a URL string. A DNS lookup will be done if necessary.
&result_bufferReference to the memory buffer in which to store the result.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoGet() [2/4]

int DoGet ( const char * pUrl,
unsigned char * result,
int maxl,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a HTTP/HTTPS GET request using a pointer to a URL string.

This function will parse the URL string to connect to the host.

Parameters
pUrlPointer to a URL string. A DNS lookup will be done if necessary.
resultPointer to the buffer in which to store the result.
maxlMaximum length of the result buffer.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns

◆ DoGet() [3/4]

bool DoGet ( ParsedURI & TheUri,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Parameters
&TheUriReference to the pre-parsed URI.
&result_bufferReference to the location to store the result.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoGet() [4/4]

int DoGet ( ParsedURI & TheUri,
unsigned char * result,
int maxl,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI)

This function uses a reference to a parsed URI, providing faster execution and avoiding parsing a URL, DNS, etc.

Parameters
TheUriReference to the ParsedURI object.
resultPointer to the buffer in which to store the result.
maxlMaximum length of the result buffer.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns

◆ DoGetEx() [1/4]

bool DoGetEx ( const char * pUrl,
const char * headers,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a HTTP/HTTPS GET request using a pointer to a URL string.

This function will parse the URL string to connect to the host.

Parameters
pUrlPointer to a URL string. A DNS lookup will be done if necessary.
headersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
&result_bufferReference to the memory buffer in which to store the result.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoGetEx() [2/4]

int DoGetEx ( const char * pUrl,
const char * headers,
unsigned char * result,
int maxl,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a HTTP/HTTPS GET request using a pointer to a URL string.

This function will parse the URL string to connect to the host.

Parameters
pUrlPointer to a URL string. A DNS lookup will be done if necessary.
headersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
resultPointer to the buffer in which to store the result.
maxlMaximum length of the result buffer.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns

◆ DoGetEx() [3/4]

bool DoGetEx ( ParsedURI & TheUri,
const char * headers,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Parameters
&TheUriReference to the pre-parsed URI.
headersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
&result_bufferReference to the location to store the result.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoGetEx() [4/4]

int DoGetEx ( ParsedURI & TheUri,
const char * headers,
unsigned char * result,
int maxl,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI)

This function uses a reference to a parsed URI, providing faster execution and avoiding parsing a URL, DNS, etc.

Parameters
TheUriReference to the ParsedURI object.
headersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
resultPointer to the buffer in which to store the result.
maxlMaximum length of the result buffer.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns

◆ DoGetUpdate() [1/2]

int DoGetUpdate ( const char * pUrl,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a firmware update from the specified URI.

Parameters
pUrlPointer to a URL string. A DNS lookup will be done if necessary.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns

◆ DoGetUpdate() [2/2]

int DoGetUpdate ( ParsedURI & TheUri,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Execute a firmware update from the specified URI.

Parameters
TheUriReference to the ParsedURI object.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns

◆ DoJsonPost() [1/4]

bool DoJsonPost ( const char * pUrl,
const char * Json_Data_To_Post,
buffer_object & result_buffer,
const char * AdditionalHeaders = NULL,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Post a JSON file using a HTTP POST and a URL string and pointer to JSON data.

Parameters
pUrlPointer to a URL string.
Json_Data_To_PostPointer to serialized JSON data
&result_bufferReference to the location in which to store the result.
AdditionalHeadersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoJsonPost() [2/4]

bool DoJsonPost ( const char * pUrl,
ParsedJsonDataSet & jsonout,
buffer_object & result_buffer,
const char * AdditionalHeaders,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Post a JSON file using a HTTP POST and a URL string.

Parameters
pUrlPointer to a URL string.
jsonoutReference to NetBurner data object. Please ref JSON lexer.
&result_bufferReference to the location in which to store the result.
AdditionalHeadersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoJsonPost() [3/4]

bool DoJsonPost ( ParsedURI & TheUri,
const char * Json_Data_To_Post,
buffer_object & result_buffer,
const char * AdditionalHeaders = NULL,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Post a JSON file using a HTTP POST and a ParsedURI object.

Parameters
&TheUriReference to the pre-parsed URI.
Json_Data_To_PostSerialized JSON data\
&result_bufferReference to the location in which to store the result.
AdditionalHeadersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoJsonPost() [4/4]

bool DoJsonPost ( ParsedURI & TheUri,
ParsedJsonDataSet & jsonout,
buffer_object & result_buffer,
const char * AdditionalHeaders,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Post a JSON file using HTTP and a ParsedURI object.

Parameters
&TheUriReference to the pre-parsed URI.
jsonoutReference to NetBurner data object. Please ref JSON lexer.
&result_bufferReference to the location in which to store the result.
AdditionalHeadersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoJsonPostHttpFile() [1/2]

bool DoJsonPostHttpFile ( const char * pUrl,
const char * FragmentName,
buffer_object & result_buffer,
const char * AdditionalHeaders,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Post a JSON file using HTTP and a URL string.

Parameters
pUrlPointer to a URL string.
FragmentName
&result_bufferReference to the location in which to store the result.
AdditionalHeadersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoJsonPostHttpFile() [2/2]

bool DoJsonPostHttpFile ( ParsedURI & TheUri,
const char * FragmentName,
buffer_object & result_buffer,
const char * AdditionalHeaders,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Post a JSON file using HTTP and a ParsedURI object.

Parameters
&TheUriReference to the pre-parsed URI.
FragmentName
&result_bufferReference to the location in which to store the result.
AdditionalHeaders
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoMultipartBoundary()

void DoMultipartBoundary ( int tcpfd,
const char * Disposition,
const char * separator )

#include <http_funcs.h>

Send a multipart boundary.

Parameters
tcpfdTCP file descriptor returned from DoMultipartStartPost()
DispositionContent disposition field of multipart body
separatorSeparator string to use as the part delimiter between multipart posts.

◆ DoMultipartFinished()

bool DoMultipartFinished ( int tcpfd,
const char * separator,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND )

#include <http_funcs.h>

Send a multipart item.

Parameters
tcpfdTCP file descriptor returned from DoMultipartStartPost()
separatorSeparator string to use as the part delimiter between multipart posts.
result_bufferReference to buffer to store result of xxxxx
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
****** Need to understand in http_funcs.cpp

◆ DoMultipartItem()

void DoMultipartItem ( int tcpfd,
const char * Disposition,
const char * separator,
const unsigned char * data,
int len )

#include <http_funcs.h>

Send a multipart item.

Parameters
tcpfdTCP file descriptor returned from DoMultipartStartPost()
DispositionContent disposition field of multipart body
separatorSeparator string to use as the part delimiter between multipart posts.
dataItem data
lenData length

◆ DoMultipartStartPost() [1/2]

int DoMultipartStartPost ( const char * pUrl,
const char * separator,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND,
uint32_t contentLength = 0 )

#include <http_funcs.h>

Start a multipart HTTP post using a pointer to a URL.

Parameters
pUrlPointer to a URL string.
separatorSeparator string to use as the part delimiter between multipart posts.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
contentLengthIf given, content length for the entire multipart post.
Returns
A TCP/TLS file descriptor greater than 0 if a socket was successfully opened, or TCP Socket Status on failure.

◆ DoMultipartStartPost() [2/2]

int DoMultipartStartPost ( ParsedURI & TheUri,
const char * separator,
uint16_t TIMEOUT_WAIT = 10 *TICKS_PER_SECOND,
uint32_t contentLength = 0 )

#include <http_funcs.h>

Start a multipart HTTP post using a pre-parsed URI object.

Parameters
&TheUriReference to the pre-parsed URI object.
separatorSeparator string to use as the part delimiter between multipart posts.
TIMEOUT_WAITTimeout in seconds to wait for a response.
contentLengthIf given, content length for the entire multipart post.
Returns
A TCP/TLS file descriptor greater than 0 if a socket was successfully opened, or TCP Socket Status on failure.

◆ DoUrlEncodedFormPost() [1/2]

bool DoUrlEncodedFormPost ( const char * pUrl,
char * headers,
char * form_data,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT )

#include <http_funcs.h>

Post a JSON file using a HTTP POST and a URL string and pointer to JSON data.

Parameters
pUrlPointer to a URL string.
headersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
form_dataPointer to the JSON data you are posting.
&result_bufferReference to the location in which to store the result.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ DoUrlEncodedFormPost() [2/2]

bool DoUrlEncodedFormPost ( ParsedURI & TheUri,
char * headers,
char * form_data,
buffer_object & result_buffer,
uint16_t TIMEOUT_WAIT )

#include <http_funcs.h>

Post a JSON file using a HTTP Form Post and a a ParsedURI object.

Parameters
&TheUriReference to the pre-parsed URI.
headersAdditional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n)
form_dataPointer to the JSON data you are posting.
&result_bufferReference to the location in which to store the result.
TIMEOUT_WAITTimeout in in system time ticks to wait for a response.
Returns
True on success, false on failure.

◆ PopulateAuthHeader()

int PopulateAuthHeader ( const char * user,
const char * password,
char * buffer,
int maxlen )

#include <http_funcs.h>

Fill in a username and password into a buffer for use as an extra header.

Parameters
userPointer to username
passwordPointer to password
bufferDestination buffer to put the authenticate header in.
maxlenMaximum number of chars to put in buffer
Returns
number of chars written, negative if the buffer was too small.

◆ SetHttpDiag()

void SetHttpDiag ( bool b)

#include <http_funcs.h>

Enable/disable Web Client HTTP diagnostics to the console port.

Parameters
bSet true to enable, false to disable.

◆ StartWebClient() [1/3]

bool StartWebClient ( int prio,
const char * url1,
const char * url2 = NULL,
bool bDoNtp = false )

#include <web_client.h>

Start the web client using a URL string.

Parameters
prioPriority
url1Pointer to a string representing the URL.
url2Pointer to a second URL. Optional parameter, default is NULL.
bDoNtpEnable the Network Time Protocol (NTP). Optional parameter, default is false.
Returns
True on success, false on failure.

◆ StartWebClient() [2/3]

bool StartWebClient ( int prio,
const NBString & url1,
bool bDoNtp = false )

#include <web_client.h>

Start the web client using a NBString.

Parameters
prioPriority
url1Reference to a NBString representing the URL.
bDoNtpEnable the Network Time Protocol (NTP). Optional parameter, default is false.
Returns
True on success, false on failure.

◆ StartWebClient() [3/3]

bool StartWebClient ( int prio,
const NBString & url1,
const NBString & url2,
bool bDoNtp = false )

#include <web_client.h>

Start the web client using a NBString.

Parameters
prioPriority
url1Reference to a string representing the URL.
url2Reference to a second URL. Optional parameter, default is NULL.
bDoNtpEnable the Network Time Protocol (NTP). Optional parameter, default is false.
Returns
True on success, false on failure.