reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofURLFileLoader.h File Reference
#include "ofEvents.h"
#include "ofFileUtils.h"
#include "ofConstants.h"
#include <map>

Go to the source code of this file.

Classes

class  ofHttpRequest
 an HTTP GET or POST request More...
 
class  ofHttpResponse
 an HTTP response to a GET or POST request More...
 
class  ofURLFileLoader
 loads a file from a URL using an HTTP request More...
 
class  ofBaseURLFileLoader
 loads a file from a URL using an HTTP request More...
 

Functions

ofHttpResponse ofLoadURL (const std::string &url)
 make an HTTP GET request blocks until a response is returned or the request times out
 
int ofLoadURLAsync (const std::string &url, const std::string &name="")
 make an asynchronous HTTP GET request will not block, placed in a queue and run using a background thread
 
ofHttpResponse ofSaveURLTo (const std::string &url, const of::filesystem::path &path)
 make an HTTP GET request and save the response data to a file blocks until a response is returned or the request times out
 
int ofSaveURLAsync (const std::string &url, const of::filesystem::path &path)
 make an asynchronous HTTP request and save the response data to a file will not block, placed in a queue and run using a background thread
 
void ofRemoveURLRequest (int id)
 remove an active HTTP request from the queue
 
void ofRemoveAllURLRequests ()
 remove all active HTTP requests from the queue
 
void ofStopURLLoader ()
 stop & remove all active and waiting HTTP requests
 
ofEvent< ofHttpResponse > & ofURLResponseEvent ()
 
template<class T >
void ofRegisterURLNotification (T *obj)
 
template<class T >
void ofUnregisterURLNotification (T *obj)
 

Function Documentation

◆ ofLoadURL()

ofHttpResponse ofLoadURL ( const std::string &  url)

make an HTTP GET request blocks until a response is returned or the request times out

Parameters
urlHTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg"
Returns
HTTP response

◆ ofLoadURLAsync()

int ofLoadURLAsync ( const std::string &  url,
const std::string &  name = "" 
)

make an asynchronous HTTP GET request will not block, placed in a queue and run using a background thread

Parameters
urlHTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg"
nameoptional key to use when sorting requests
Returns
unique id for the active HTTP request

◆ ofRegisterURLNotification()

template<class T >
void ofRegisterURLNotification ( T *  obj)

◆ ofRemoveAllURLRequests()

void ofRemoveAllURLRequests ( )

remove all active HTTP requests from the queue

◆ ofRemoveURLRequest()

void ofRemoveURLRequest ( int  id)

remove an active HTTP request from the queue

Parameters
idHTTP request id

◆ ofSaveURLAsync()

int ofSaveURLAsync ( const std::string &  url,
const of::filesystem::path &  path 
)

make an asynchronous HTTP request and save the response data to a file will not block, placed in a queue and run using a background thread

make an asynchronous HTTP request for a url and save the response to a file at path

Returns
unique request id for the active HTTP request
Parameters
urlHTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg"
pathfile path to save to
Returns
unique id for the active HTTP request

◆ ofSaveURLTo()

ofHttpResponse ofSaveURLTo ( const std::string &  url,
const of::filesystem::path &  path 
)

make an HTTP GET request and save the response data to a file blocks until a response is returned or the request times out

Parameters
urlHTTP url to request, ie. "http://somewebsite.com/someapi/someimage.jpg"
pathfile path to save to
Returns
HTTP response on success or failure

◆ ofStopURLLoader()

void ofStopURLLoader ( )

stop & remove all active and waiting HTTP requests

◆ ofUnregisterURLNotification()

template<class T >
void ofUnregisterURLNotification ( T *  obj)

◆ ofURLResponseEvent()

ofEvent< ofHttpResponse > & ofURLResponseEvent ( )