user59233: Why is it that when i use this code for http request on DFRobot_sim808 , I get 'fetch over' message, that means that no data is being returned?
char strings:
char http_cmd[] = " HTTP/1.0\r\n"
                        "Host: 5ac80719.ngrok.io\r\n"
                        "\r\n";
char first[] = "GET /index.php?lat=";

char requestion[100];

functions to join them:

void setup() {
  float lat = 32.685362, lon = 48.411512;
  char char_coor[10];

  mySerial.begin(9600);
  Serial.begin(9600);

// Set Http Cmd
  strcpy(requestion,first);
// For Convert latitude float to char
  dtostrf(lat, 4, 6, char_coor);  
  strcat(requestion,char_coor);
// For Convert longitude float to char
  dtostrf(lon, 4, 6, char_coor);
  strcat(requestion,"&long=");
  strcat(requestion,char_coor);
  strcat(requestion,http_cmd);

.
.
.

and fetching:
sim808.send(requestion, strlen(requestion)-1);
  while (true) {
      int ret = sim808.recv(buffer, sizeof(buffer)-1);
      if (ret <= 0){
          Serial.println("fetch over...");
          break; 
      }

/*
The program stops at above
*/

      buffer[ret] = '\0';
      Serial.print("Recv: ");
      Serial.print(ret);
      Serial.print(" bytes: ");
      Serial.println(buffer);
      break;
  }

thanks

user37523: One problem I can see is the while loop has a break statement in it that "exits" the while loop before printing the data. Removing that break and printing the data out where the break "was" may help. Here's an example of what I'm trying to say:
void setup(){
  Serial.begin(9600);  
}

void loop(){

  while(true){
    int ret = 0;
    if(ret <= 0){
      Serial.println("fetch over...");
      // Print out the received data here...
      Serial.print("Recv: ");
      Serial.print(ret);
      break;
    }
  }

}


59233: <p>Why is it that when i use this code for http request on DFRobot_sim808 , I get 'fetch over' message, that means that no data is being returned?</p>

<p>char strings:</p>

<pre class="lang-c prettyprint-override"><code>char http_cmd[] = " HTTP/1.0\r\n"
                        "Host: 5ac80719.ngrok.io\r\n"
                        "\r\n";
char first[] = "GET /index.php?lat=";

char requestion[100];
</code></pre>

<p>functions to join them:</p>

<pre class="lang-c prettyprint-override"><code>
void setup() {
  float lat = 32.685362, lon = 48.411512;
  char char_coor[10];

  mySerial.begin(9600);
  Serial.begin(9600);

// Set Http Cmd
  strcpy(requestion,first);
// For Convert latitude float to char
  dtostrf(lat, 4, 6, char_coor);  
  strcat(requestion,char_coor);
// For Convert longitude float to char
  dtostrf(lon, 4, 6, char_coor);
  strcat(requestion,"&amp;long=");
  strcat(requestion,char_coor);
  strcat(requestion,http_cmd);

.
.
.
</code></pre>

<p>and fetching:</p>

<pre class="lang-c prettyprint-override"><code>sim808.send(requestion, strlen(requestion)-1);
  while (true) {
      int ret = sim808.recv(buffer, sizeof(buffer)-1);
      if (ret &lt;= 0){
          Serial.println("fetch over...");
          break; 
      }

/*
The program stops at above
*/

      buffer[ret] = '\0';
      Serial.print("Recv: ");
      Serial.print(ret);
      Serial.print(" bytes: ");
      Serial.println(buffer);
      break;
  }
</code></pre>

<p>thanks</p>
 37523: <p>One problem I can see is the <code>while</code> loop has a <code>break</code> statement in it that "exits" the <code>while</code> loop before printing the data. Removing that <code>break</code> and printing the data out where the <code>break</code> "was" may help. Here's an example of what I'm trying to say:</p>

<pre><code>void setup(){
  Serial.begin(9600);  
}

void loop(){

  while(true){
    int ret = 0;
    if(ret &lt;= 0){
      Serial.println("fetch over...");
      // Print out the received data here...
      Serial.print("Recv: ");
      Serial.print(ret);
      break;
    }
  }

}
</code></pre>
