h

Dependencies:   mbed EthernetNetIf

main.cpp

Committer:
okini3939
Date:
2011-07-27
Revision:
0:f2bf5f966801
Child:
2:764ecec3dc59

File content as of revision 0:f2bf5f966801:

#include "mbed.h"
#include "EthernetNetIf.h"
#include "TCPSocket.h"
#include "TinyHTTP.h"

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
EthernetNetIf eth;

int main () {
    EthernetErr ethErr;
    Host host;
    int r;

    myled = 1;

    ethErr = eth.setup();
    if(ethErr) {
        return -1;
    }

    host.setName("mbed.org");
    r = httpRequest(METHOD_GET, &host, "/", NULL, NULL);
/*
    host.setName("www.domain.name");
    r = httpRequest(METHOD_POST, &host, "/xxx.cgi", "Content-Type: application/x-www-form-urlencoded\r\n", "key=value&key2=value2");
*/
    printf("status %d\r\n", r);

    myled = 0;
    return 0;
}