-->
Page 1 of 1

HTTP Requests to Pushingbox Not Working

PostPosted: Sun Feb 26, 2017 7:58 am
by Jeen26
I am using ESP8266 with Arduino Uno. I want to data log some variables to Pushingbox. I tried using the code withThingspeak server and it works perfectly. The same code fails for Pushingbox. I tried to push values using the pushingbox url via browser and it works.

This is the code I am using

Code: Select all#include <stdlib.h>



// connect 10 to TX of Serial USB
// connect 11 to RX of serial USB
SoftwareSerial ser(10, 11); // RX, TX


void setup() {               
 
  // enable debug serial
  Serial.begin(9600);
  // enable software serial
  ser.begin(9600);
 
  // reset ESP8266
  ser.println("AT+RST");
}


// the loop
void loop() {

  // TCP connection
  String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += "api.pushingbox.com"; //
  cmd += "\",80";
  ser.println(cmd);
  Serial.println(cmd);
   
  if(ser.find("Error")){
    Serial.println("AT+CIPSTART error");
    return;
  }
 
  // prepare GET string
  String getStr = "GET api.pushingbox.com/pushingbox?devid=vB142D4A918331D6&tempdata=53";
 
  // send data length
  cmd = "AT+CIPSEND=";
  cmd += String(getStr.length());
  ser.println(cmd);
  Serial.println(cmd);
  if(ser.find(">")){
    ser.print(getStr);
    Serial.print(getStr);
  }
  else{
    ser.println("AT+CIPCLOSE");
    // alert user
    Serial.println("AT+CIPCLOSE");
  }

  delay(16000); 
}



I also tried to do GET requests using AT commands via serial monitor but it gets timeout as I enter the values.