Hi,
I have been struggling for two days and can not find a solution, I hope someone can assist me.
I have the UNO and a ENC28J60, all the examples that come with the ethernet library work 100%.
I have a website www.manski.co.za/default.aspx if I want to insert new records I add a ?id=id123 on the address and it will insert the record. That is tested and working.
I got this code that everyone seems to be using and modified it without any success.
Please assist.
#include <EtherCard.h>
// your variable
#define PATH "default.aspx?"
#define VARIABLE "testing123"
// ethernet interface mac address, must be unique on the LAN
byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
char website[] PROGMEM = "www.manski.co.za";
byte Ethernet::buffer[700];
uint32_t timer;
Stash stash;
void setup () {
Serial.begin(9600);
Serial.println("\n[webClient]");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 10000;
byte sd = stash.create();
stash.print("?id=");
stash.print(VARIABLE);
stash.print("&action=Submit");
stash.save();
// generate the header with payload - note that the stash size is used,
// and that a "stash descriptor" is passed in as argument using "$H"
Stash::prepare(PSTR("POST http://www.manski.co.za/default.aspx" "\r\n"
"Host: $F" "\r\n"
"Content-Length: $D" "\r\n"
"\r\n"
"$H"),
website, PSTR(PATH), website, stash.size(), sd);
// send the packet - this also releases all stash buffers once done
ether.tcpSend();
}
}