its been a while but i had a busy schedule. i have tried to use your code surferTim, allthough it still doesnt work.
code arduino:
(cus ur code was based on some kind of temperaturesensor i changed some values (maybe i did something wrong?)
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 177 };
byte gateway[] = {192, 168, 1, 177};
//byte subnet[] = {255, 255, 255, 0};
// byte server1(159, 253, 5, 5);
byte dnsadres[] = { 8, 8, 8, 8 };
char server[] = "lifestyle.daandamhuis.nl";
EthernetClient client;
int totalCount = 0;
int loopCount = 0;
void setup() {
Serial.begin(9600);
Ethernet.begin(mac, ip, dnsadres);
delay(2000);
Serial.println("Ready");
}
char pageAdd[32];
void loop()
{
if(loopCount < 30)
{
delay(1000);
}
else
{
loopCount = 0;
sprintf(pageAdd,"/backend/fetchAantalOpen.php",totalCount);
if(!getPage(server,pageAdd)) Serial.print("Fail ");
else Serial.print("Pass ");
totalCount++;
Serial.println(totalCount,DEC);
}
loopCount++;
}
byte getPage(char *ipBuf,char *page)
{
char inChar;
char outBuf[128];
Serial.print("connecting...");
if(client.connect(ipBuf,80))
{
Serial.println("connected");
sprintf(outBuf,"GET %s HTTP/1.0\r\n\r\n",page);
client.write(outBuf);
}
else
{
Serial.println("failed");
return 0;
}
int connectLoop = 0;
while(client.connected())
{
while(client.available())
{
inChar = client.read();
Serial.write(inChar);
connectLoop = 0;
}
delay(10);
connectLoop++;
if(connectLoop > 1000)
{
Serial.println();
Serial.println("Timeout");
client.stop();
}
}
Serial.println();
Serial.println("disconnecting.");
client.stop();
return 1;
}
PHP code
//session_start();
//include('../scripts/php/connect.php');
<!DOCTYPE html>
<html>
<body>
$what_the_arduino_reads = '1'.base_convert(rand(10000,9999999), 10, 36);
<? echo '@'.$what_the_arduino_reads.'#'; ?>
</body>
</html>
what i get on my arduino monitor:
Ready
connecting...connected
HTTP/1.1 404 Not Found
Date: Mon, 03 Dec 2012 21:35:25 GMT
Server: Apache/2
Content-Length: 405
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /backend/fetchAantalOpen.php was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache/2 Server at localhost Port 80</address>
</body></html>
disconnecting.
Pass 1
it somehow can't find the url path, but its right. also it says HTTP/1.1 404 Not Found even though i ask HTTP/1.0?
it really doesn't make much sense too me...