Go Down

Topic: HELP on pushingbox HTTP request (Read 3 times) previous topic - next topic

tsgrau08

Well, my compiler did not like replacing the #define with the string.  I think it was because of the location in the program.

But the #define thing seems to be working fine.  However, when I push the button, I get the correct text output on my serial output, but no e-mail.

When I try the e-mail test feature on pushingbox, it works only sometimes also.  Is there some kind of limit on how may requests can be sent in a given period of time?

Still having trouble.  Only getting an infrequent number of successful e-mail.

JoostRomanus

Hi
I'm having exactly the same issue. Sometimes it works for days. Then it stops working or only few mails go through.
Each time the Arduino reports a correct connection. When I try with cURL or with a browser, it works OK.
I tried a lot of different things:
- another Arduino and Ethernet card. Network is OK on both, I can brwse to them perfectly (they're server as well).
- putting \r\n as end of line instead of just \n
- change #define to const String..., but this is just cosmetics
- start the card with or witout mentionning dns, gateway. No difference.
Here the code:
void sendToPushingBox(String devid){
  #ifdef DEBUG_SERIAL
    Serial << F("Connecting to PushingBox") << newLineSerial;
  #endif
  if (client.connect(serverName, 80)) {
    #ifdef DEBUG_SERIAL
      if(client.connected())
        Serial << F("client connected to PushingBox") << newLineSerial;
      else
        Serial << F("client NOT connected to PushingBox") << newLineSerial;
      Serial << F("sending GET request") << newLineSerial;
    #endif
    Serial << F("GET /pushingbox?devid=") << devid << F(" HTTP/1.1\r\n");
    Serial << F("Host: ") << serverName << F("\r\n");
    Serial << F("User-Agent: Arduino\r\n");
    Serial << F("\r\n");
    client << F("GET /pushingbox?devid=") << devid << F(" HTTP/1.1\r\n");
    client << F("Host: ") << serverName << F("\r\n");
    client << F("User-Agent: Arduino\r\n");
    client << F("\r\n");
  }
  else {
    Serial << F("PushingBox connection failed") << newLineSerial;
  }
  // if there are incoming bytes available from the server, read and print them:
  #ifdef DEBUG_SERIAL
    delay(1000);
    if (client.available()) {
      char c = client.read();
      Serial << c;
    }
    Serial << F("disconnecting") << newLineSerial;
  #endif
  client.stop();
}


Here the debug-info:
Setting up Ethernet card
Ready, delay 5 sec to setup Ethernet card
Connecting to PushingBox
client connected to PushingBox
sending GET request
GET /pushingbox?devid=vDCC7D695F4F8672 HTTP/1.1
Host: api.pushingbox.com
User-Agent: Arduino

disconnecting


I guess it's more a network issue, but I can't put my hands on it. Does someone have an idea? If not I'll need to put a sniffer to see what exactly is going over the network.

smily77

Same issue on my side or even worse. My sketch (the GET request pretty much as the official one) worked now for about 3 month well. Now it doesn't work any more and the official one doesn't work either.

From the browser or with curl it works perfect on my PC.

What makes it really strange: My sketch places a GET request to an other server at the same time. This works as it should.

SurferTim

#8
Nov 27, 2012, 01:05 pm Last Edit: Nov 27, 2012, 01:09 pm by SurferTim Reason: 1
Have you tried reading the response from the server? Maybe it is trying to tell you something and you are ignoring it.
Code: [Select]
// if there are incoming bytes available from the server, read and print them:
   while(client.connected()) {
     while(client.available()) {
       char c = client.read();
       Serial << c;
     }
   }
   Serial << F("disconnecting") << newLineSerial;
   client.stop();


edit: Here is my client code on the playground. It has this and a timeout disconnect.
http://www.arduino.cc/playground/Code/WebClient

smily77

Yes you would be right. Often the answer on the problem is in the response. But not here as I don't get any response at all. It seams that the server doesn't simply understand anything after get connected.

I found a kind of solution which makes it working now but it isn't really a sadifying solution:

The official example is like this: (and doesn't work)
Code: [Select]

    if(DEBUG){Serial.println("sendind request");}
    client.print("GET /pushingbox?devid=");
    client.print(devid);
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println(serverName);
    client.println("User-Agent: Arduino");
    client.println();



If I replace it and write everything in one line to the client it works
Code: [Select]
   
if(DEBUG){Serial.println("sendind request");}
    client.println("GET /pushingbox?devid=vXXXXXXXXXXXXXXX HTTP/1.1");
    client.print("Host: ");
    client.println(serverName);
    client.println("User-Agent: Arduino");
    client.println();

?????
What is going wrong here??

Go Up