ENC28J60 Pushing data to 000webhost PHPMyAdmin

Hi everyone! I could finally made my way to creat a host on 000webhosting where I set a basic database of temp and Humidity (the classic one), it seems to be working fine since when I type in the URL Firefox http://bamboklaat.hostzi.com/php/habitacion_web.php?t=25&h=53 the database get the values, so the php script is kicking, the problem is when I send the data via arduino (the conection is achieved!), I editted some of the program I used for sending data to MyAdmin installed in my computer and worked well, simply changed the Server number, the php file name and its forder where it is, the symbolic modified one is:

#include <UIPEthernet.h>
char server = “bamboklaat.hostzi.com”;

if (client.connect(server,80)) {
Serial.println("-> Connected"); //(it does connect!)
// Make a HTTP request:
client.print( “GET /php/habitacion_web.php”);
client.print(“t=”);
client.print(str_t);
client.print("&");
client.print(“h=”);
client.print(str_h);
client.println( " HTTP/1.1");
client.print( "Host: " );
client.println(server);
client.println( “Connection: close” );
client.println();
client.println();
client.stop();
}

I´ve been looking around the internet and could not figure out, I suspect its a progrmming thing that I cant see. Hope someone can guide me a little bit. Thanks for reading and taking your time.

Greettings,

Luciano

SOLVED in other forum, a "?" was missing after "habitacion_web.php" in the line "client.print( "GET /php/habitacion_web.php"); "

Thanks for posting your problem and solution. This was very helpful as it confirmed that my GET message appears to be in the correct format with the exception of the check for client.connected(). I was using that but I would frequently lose connection so I used client.connect() as my opening conditional check (please see code below).

If I understand this correctly, a get message should be the same but does not need the message body at the end as I should just be modifying the URL that is passed, right?

My code for sending the GET message is below. I am using the Arduino WiFi Shield with an Arduino UNO but my .php file is not receiving the message. I believe the .php file is correct as I am able to validate using the curl command.

Code:

if (client.connect(server,80)) {

client.print( “GET /arduino-test1/arduino-iot-test-july2015/addsensordata.php?”);
client.print(“temp1=”);
client.print( currentTemp );
client.print("&");
client.print(“photo1=”);
client.print( currentTemp );
client.print( " HTTP/1.1\r\n");
client.print( “Host: www.*****.org\r\n” );
client.print( “Content-Type: application/x-www-form-urlencoded\r\n” );
client.print( “Connection: close\r\n\r\n” );

client.stop();
}
else {
Serial.println(“Disconnected”);
}

If I observe the message using the serial port, it looks like the following.

GET /arduino-test1/arduino-iot-test-july2015/addsensordata.php?temp1=26.06&photo1=26.06 HTTP/1.1
Host: www.*****.org
Content-Type: application/x-www-form-urlencoded
Connection: close

It appears that my code looks very similar to yours so I am not sure what is going on… Any thoughts here? Are you using the Arduino WiFiShield with the latest firmware and an Arduino UNO? (Hopefully yes so there are less unknown variables…:))

Thanks for any help that you could provide…

Hi!

Details:

1- My conection is not steady at all, lose connection frecuently, talked with some vendors and they all agree that ENC28J60 is more for educational issues (soo cheap too). The shield is the good one.
2- I used the lib call UIPEthernet.h for this board.

weird to see why you get that on the serial monitor since you are executing client.print( “GET /arduino-test1/arduino-iot-test-july2015/addsensordata.php?”); …

Accordingto my expererience and readings, your UNO is running out of sram (2k total) when use many “Prints” or long strings, if your arduino idle is not up to date (like mine) you wont know. I suffered creating long strings (for folders & subforders) for writing into an SD using UNO, I changed to Mega (8K total sram) to avoid these issues. When lack of sram happends, weird shit happends too.
I would try to avoid such a long string : arduino-test1/arduino-iot-test-july2015 , so with Content-Type: application/x-www-form-urlencoded\r\n I would split it up with more client.print´s, and make every “Serial.print” to be a comment with //.

check this one https://www.arduino.cc/en/Tutorial/Memory