sending arduino data to my database using EtherCard.h library

Hi! I am having a problem in sending Arduino data into my database. I am currently using WAMPSERVER. I have an arduino mini w/ ATMEGA 328 and I am using ENC28J60. The problem is I have tried different libraries and examples to send data into the server but I failed. I just notice that some libraries are not compatible with my enc28J60. I have tried UIPEthernet.h, Ethernet.h, etherShield.h and EtherCard.h. The etherShield.h and EtherCard.h seemed to work just fine. But I prefer to use EtherCard.h because I heard etherShield is the older lib. I know a little php.

I think the things that might guide me is to see a working example of using the EtherCard.h library demonstrating the sending of sensor data from arduino into my database. The network setup I am currently working on is that, the ENC28J60 is connected in my home network with an ip address of 192.168.10.10. The server to which I placed the database is my laptop with an IP address of 192.168.10.2. I am placing the php files in this directory C:\wamp\www. I hope I have explained it well. I'm sorry for my English.

Hi,
I used EtherCard library for sending data to my server. I attached some my connection testing sketch.

// Demo using DHCP and DNS to perform a web client request.
// 2011-06-08 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[700];
static uint32_t timer;

char website[] PROGMEM = "192.168.10.2";
//char website[] PROGMEM = "google.com";

// called when the client request is complete
static void my_callback (byte status, word off, word len) {
  Serial.println(">>>");
  Ethernet::buffer[off+300] = 0;
  Serial.print((const char*) Ethernet::buffer + off);
  Serial.println("...");
}

void setup () {
  Serial.begin(57600);
  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() + 5000;
    Serial.println();
    Serial.print("<<< REQ ");
    ether.hisport = 8080;//to access  local host
    ether.browseUrl(PSTR("/HouseLogger/HouseLogger?"), "get=Hello", website, my_callback);
  }
}

Some higlights:
adress of your server, in this time local computer

char website[] PROGMEM = "192.168.10.2";

If you use other port that 80, change it here:

ether.hisport = 8080;//to access  local host

Specification of path on server and parametres for server:

ether.browseUrl(PSTR("/HouseLogger/HouseLogger?"), "get=Hello", website, my_callback);

That works well; thanks.

hi, i'm trying to use it, but with my teste page it doesnt work.

on php i'm using the code bellow but nothing happens.

<?php if(isset($_GET['get']) or isset($_POST['get'])){ mkdir('/teste', 0777, true); chmod('/teste', 0777); echo "Feito"; }else{ echo "Vazio"; } ?>

My apache server in on 192.168.0.100 on port 80, name of the test file is callback.php and his location is 192.168.0.100/seguranca/callback.php.

are right my changes bellow?

char website[] PROGMEM = "192.168.0.100";

ether.hisport = 80;//to access local host
ether.browseUrl(PSTR("/seguranca/callback?"), "get=Hello", website, my_callback);

Hi.

Does anyone know how to implement a standard chat server using Ethercard? I can't seem to find an example anywhere. I've done it successfully using the regular Ethernet and UIPEthernet, but can't get it on Ethercard.

Thanks!