I have been trying for weeks to find a solution to this but after all the examples, tutorials, code snippets, etc... I just cannot get this to send the data to the server.... I am at the moment trying to get it to work with the ethercard library but I will go with whatever library will do what I need to do which is just basically send a GET request to the php page and return anything coming back but I have tried everything even the example webclient does not work, I know the ENC module works as I had been using it as a small webserver testing it
// This demo does web requests to a fixed IP address, using a fixed gateway.
// 2010-11-27 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
#define REQUEST_RATE 5000 // milliseconds
// ethernet interface mac address
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
// ethernet interface ip address
static byte myip[] = { 192,168,0,203 };
// gateway ip address
static byte gwip[] = { 192,168,0,1 };
// remote website ip address and port
static byte hisip[] = { 192.168.0.242 };
// remote website name
char website[] PROGMEM = "PC2";
byte Ethernet::buffer[300]; // a very small tcp/ip buffer is enough here
static long timer;
// called when the client request is complete
static void my_result_cb (byte status, word off, word len) {
Serial.print("<<< reply ");
Serial.print(millis() - timer);
Serial.println(" ms");
Serial.println((const char*) Ethernet::buffer + off);
}
void setup () {
Serial.begin(57600);
Serial.println("\n[getStaticIP]");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
ether.staticSetup(myip, gwip);
ether.copyIp(ether.hisip, hisip);
ether.printIp("Server: ", ether.hisip);
while (ether.clientWaitingGw())
ether.packetLoop(ether.packetReceive());
Serial.println("Gateway found");
timer = - REQUEST_RATE; // start timing out right away
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer + REQUEST_RATE) {
timer = millis();
Serial.println("\n>>> REQ");
ether.browseUrl(PSTR("#sclient=psy-ab&q=enc28j60+arduino+wiring"), "", website, &my_result_cb);
Serial.println("\ndone>>>");
}
}
here is the output in the serial monitor:
My IP: 192.168.0.203
Netmask: 255.255.255.0
Server: 192.168.0.242
Pinging: 192.168.0.242
Sending a request...
Pinging: 192.168.0.242
Sending a request...
Pinging: 192.168.0.242
Sending a request...
and it just continues with pinging and sending a request .... If I run the webclient sketch example that comes with the ethercard library it does the same kind of thing it never runs the my_callback only returns <<< REQ in the serial monitor
Is there anyone on here that may be able to point me in the right direction because I can not get this to work and I am almost bald because of it. There has to be a way to do it but everything I have tried does not work, I am not sure if I am using the same version of library or what but no matter how many examples I've tried I can't get any to work. Not even the example with the ethercard library. I can setup a webserver on the arduino that works fine though.
WAMP... Windows... Microsoft Firewall with Advanced Security...
Am I on the right track?
If so, go into MFAS and add a rule to open the inbound HTTP port. It will be blocked by default. Could just as easily be blocked by whatever other security/antivirus package you may b erunning.
I cursed the Wiznet W5100 and Ethernet library until I discovered that was the culprit when I first played around with them. I could ping from the PC to my arduino but the other direction... Nada.