see: https://developer.mbed.org/users/phsfan/notebook/phsshield/

Dependencies:   a3gs mbed

Committer:
phsfan
Date:
Tue Mar 10 01:18:38 2015 +0000
Revision:
0:864cc2bec4bf
1st build

Who changed what in which revision?

UserRevisionLine numberNew contents of line
phsfan 0:864cc2bec4bf 1 /*
phsfan 0:864cc2bec4bf 2 * mbed Tiny HTTP Client for Ethernet Interface Library
phsfan 0:864cc2bec4bf 3 * Copyright (c) 2012 Hiroshi Suga
phsfan 0:864cc2bec4bf 4 * Released under the MIT License: http://mbed.org/license/mit
phsfan 0:864cc2bec4bf 5 */
phsfan 0:864cc2bec4bf 6
phsfan 0:864cc2bec4bf 7 /** @file
phsfan 0:864cc2bec4bf 8 * @brief Tiny HTTP Client
phsfan 0:864cc2bec4bf 9 */
phsfan 0:864cc2bec4bf 10
phsfan 0:864cc2bec4bf 11 #ifndef TinyHTTP_h
phsfan 0:864cc2bec4bf 12 #define TinyHTTP_h
phsfan 0:864cc2bec4bf 13
phsfan 0:864cc2bec4bf 14 #include "mbed.h"
phsfan 0:864cc2bec4bf 15
phsfan 0:864cc2bec4bf 16 #define HTTP_PORT 80
phsfan 0:864cc2bec4bf 17 #define HTTP_TIMEOUT 3000 // ms
phsfan 0:864cc2bec4bf 18
phsfan 0:864cc2bec4bf 19 #define METHOD_GET 0
phsfan 0:864cc2bec4bf 20 #define METHOD_POST 1
phsfan 0:864cc2bec4bf 21
phsfan 0:864cc2bec4bf 22 typedef void (*onHttpReceiveFunc)(char *buf, int len);
phsfan 0:864cc2bec4bf 23
phsfan 0:864cc2bec4bf 24 /** send http request
phsfan 0:864cc2bec4bf 25 * @param method METHOD_GET or METHOD_POST
phsfan 0:864cc2bec4bf 26 * @param host http server
phsfan 0:864cc2bec4bf 27 * @param uri URI
phsfan 0:864cc2bec4bf 28 * @param head http header (CR+LF) (or NULL)
phsfan 0:864cc2bec4bf 29 * @param body POST body (or NULL)
phsfan 0:864cc2bec4bf 30 * @return http code, -1:failue
phsfan 0:864cc2bec4bf 31 */
phsfan 0:864cc2bec4bf 32 int httpRequest (int method, char *host, int port, char *uri, char *head, char *body, onHttpReceiveFunc func);
phsfan 0:864cc2bec4bf 33
phsfan 0:864cc2bec4bf 34 void createauth (char *user, char *pwd, char *buf, int len);
phsfan 0:864cc2bec4bf 35
phsfan 0:864cc2bec4bf 36 int base64enc(const char *input, unsigned int length, char *output, int len);
phsfan 0:864cc2bec4bf 37
phsfan 0:864cc2bec4bf 38 int urlencode(char *str, char *buf, int len);
phsfan 0:864cc2bec4bf 39
phsfan 0:864cc2bec4bf 40 #endif