hi I'm still working with my little LOG project!
I have now had it running longer on my local server 6-7 months.
and running smoothly.
Now I would move it out on a web hosting.
and no now does nothing to work.
I've done it 100% the same as on the local server.
Why it will not work on a wephotel.
here a piece of code:
void data_sendt()
{
// every thirty seconds this runs
// Data der skal sendes til server
// Tekst efter id= er inverterens serienummer eller ID
// Tekst efter data= er data fra inverter. Data skal sendes i følgende rækkefølge:
// temp, vac, vdc1, idc1, vdc2, idc2, etoday, etot, power
sprintf(pageAdd,"/test_fil_1_ok_3.php?id=kimkimkim&temp=125,658,987",totalCount);
if(!getPage(serverName,pageAdd)) Serial.print("Fail ");
else Serial.print("Pass ");
totalCount++;
Serial.println(totalCount,DEC);
}
byte getPage(char* domainBuffer,char* page)
{
int inChar;
char outBuf[200];
Serial.print("connecting...");
if(client.connect(domainBuffer,80))// ændres til 8005 -> test eller 8000 -> data
{
Serial.println("connected");
sprintf(outBuf,"GET %s HTTP/1.0\r\n\r\n",page);
client.write(outBuf);
}
else
{
Serial.println("failed");
return 0;
}
// connectLoop controls the hardware fail timeout
int connectLoop = 0;
while(client.connected())
{
while(client.available())
{
inChar = client.read();
Serial.write(inChar);
// set connectLoop to zero if a packet arrives
connectLoop = 0;
}
connectLoop++;
// if more than 10000 milliseconds since the last packet
if(connectLoop > 10000)
{
// then close the connection from this end.
Serial.println();
Serial.println("Timeout");
client.stop();
}
// this is a delay for the connectLoop timing
delay(1);
}
Serial.println();
Serial.println("disconnecting.");
// close client end
client.stop();
return 1;
}
void printTemperature(DeviceAddress deviceAddress)
{
sensors.requestTemperatures();
float tempC = sensors.getTempC(deviceAddress);
Serial.print("tempC");
Serial.println(tempC*100);
tempc[0]=tempC*100;
}
void printbeholderThermometer(DeviceAddress deviceAddress)
{
sensors.requestTemperatures();
tempA = sensors.getTempC(deviceAddress);
Serial.print("tempA");
Serial.println(tempA*100);
tempc[1]=tempA*100;
}
void printfyrThermometer(DeviceAddress deviceAddress)
{
sensors.requestTemperatures();
tempB = sensors.getTempC(deviceAddress);
Serial.print("tempB");
Serial.println(tempB*100);
tempc[2]=tempB*100;
}
and here receives the code in php!
$id=$_GET["id"];
//echo $id;
if (!is_dir( "data")) {
mkdir("data");
}
if (!is_dir( "data" . "/" . $id)) {
mkdir("data" . "/" . $id);
}
//mkdir("testing" . "/" . "data");
$date = date("Y-m-d");
$prefix=$id;
$suffix=$date;
$filename= "data" . "/" . $id . "/" .$suffix.".csv";
echo $filename;
define("LOG_FILE", $filename);
if(!isset($_GET["temp"])) die("no value present");
$temp = $_GET["temp"];
$tempdel= explode(",", $temp);
$tempdel[0]=$tempdel[0]/100;
$tempdel[1]=$tempdel[1]/100;
$tempdel[2]=$tempdel[2]/100;
$tempdel[3]=$tempdel[3]/100;
$tempdel[4]=$tempdel[4]/100;
$tempdel[6]=$tempdel[6]-131;
//DD-MM-YYYY TT:MM:SS
$date=date("d-m-Y H:i", time());
$file_handler = fopen(LOG_FILE, "a+");
fwrite($file_handler, $date . "," . $tempdel[0]."," . $tempdel[1] ."," . $tempdel[2] ."," . $tempdel[3] ."," . $tempdel[4] ."," . $tempdel[5] ."," . $tempdel[6] ."\r\n");
fflush($file_handler);
echo "OK";
best Kim Jessen