Wio LTE httpGet missed, anyway to use get method?

Hello,
I'm using Wio LTE library to controlling my Quectel EC21 Gsm+Gps module.
I need to get data from a web page with http get method.
The httpGET function is on ethernet.h but its empty function and not located on ethernet.cpp.
There is another way to query get, TCP IP method but I coudnt succeeded.

Here is my code;

#include "ethernet.h"

Ethernet eth = Ethernet();

// APN setting here
const char apn[25] = "internet";

// https://webhook.site/457acaa4-ea36-459a-a8c8-b275a21a5df2
const char URL[100] = "webhook.site";
char http_cmd[100] = "GET /457acaa4-ea36-459a-a8c8-b275a21a5df2 HTTP/1.0\r\n\r\n";

int port = 80;
int ret = 0;

void setup() {

    // Power up the modem...
    Serial.begin(9600);
    Serial.println("Begin...");
    eth.Power_On();
    while (false == eth.Check_If_Power_On()) {
        Serial.println("Waitting for module to alvie...");
        delay(1000);
    }

    // Initialization
    while (!eth.init()) {
        delay(1000);
        Serial.println("Accessing network...");
    }

    Serial.println("Initialize done...");

    eth.join(apn);
    Serial.print("\n\rIP: ");
    Serial.print(eth.ip_string);

    if (eth.connect(URL, port, TCP)) {
        eth.write(http_cmd);
        while (MODULE_PORT.available()) {
            serialDebug.write(MODULE_PORT.read());
        }
        eth.close(1);
    } else {
        Serial.println("Connect Error!");
    }

}

void loop() {
    /* Debug */
    AT_bypass();
}

And here is my serial monitor response...

Begin...
Initialize done...
IP: 10.78.243.74
+QIURC: "recv",0,1420

HTTP/1.1 500 Internal Server Error

Server: nginx

Content-Type: text/html; charset=UTF-8

Connection: close

Cach Aug 2023 15:22:28 GMT

pragma: no-cacheize:1em}[hidden]{dibefore{box-sizing:border-box}.bg-gray-100{--bg-opacity:1;background-color:#f7fafc;background-color:rgba(247,250,252,var(--bg-opacity))}.border-gray-200{--border-opacity:1;border-color:#edf2f7;border-color:rgba(237



+QIURC: "recv",0,1420

,242,247,var(--border-opacity))}.borde}5-animation-timing-funct{transform:translateY(0);-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@media (min-width:640px){.sm\:rounded-lg{border-radius:.5rem}.sm\:block{display:block}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:h-20{height:5rem}.sm\:ml-0{margin-left:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}}@media (min-width:768px){.md\:border-t-0{border-top-width:0}.md\:border-l{border-left-width:1px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (prefers-color-scheme:dark){.dark\:bg-gray-800{--bg-opacity:1;background-color:#2d3748;background-color:rgba(45,55,72,var(--bg-opacity))}.dark\:bg-gray-900{--bg-opacity:1;background-color:#1a202c;background-color:rgba(26,32,44,var(--bg-opacity))}.dark\:border-gray-700{--border-opacity:1;border-color:#4a5568;border-color:rgba(74,85,104,var(--border-opacity))}.dark\:text-white{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.dark\:text-gray-400{--text-opacity:1;color:#c



+QIURC: "recv",0,1063

bd5e0;color:rgba(203,213,224,var(--tex

How can I do get query?

Why wasting 100 bytes for a 13 byte string?

If you do the same command on your PC using telnet you also get a 500 result code.
If you add a Host-Header it is successful:

char http_cmd[100] = "GET /457acaa4-ea36-459a-a8c8-b275a21a5df2 HTTP/1.0\r\nHost: webhook.site\r\n\r\n";

1 Like

The response with your suggestion is;

+QIURC: "recv",0,384

HTTP/1.1 200 OK

Server: nginx

Content-Type: text/plain; charset=UTF-8

Connection: close

Vary: Accept-Encoding

X-Request-Id: 283e30e

The expected result is have to be like;

A12345,B12345,C12345,D12345,E12345,F12345,G12345,H12345,

That are the headers of the response. You didn't provide a link to the library you're using but the construct with sending commands by the eth object but getting the response by some MODULE_PORT is rather special. You only read what's available immediately after you sent the request. If the body needs some time you might have missed it. But if you get a 200 response you most probably also got the content you expected.

1 Like

What do I have to do to get what I need?

Post a link to the library you're using!

You might also getting a response if you wait for 200ms after sending the command but that's only to see if my guess is correct, that's not a solution!

1 Like

Here it is;

Excuse me but this library is an impertinence for every user. Almost no documentation, minimal examples, unimplemented prototypes, etc.

I assume that you only read the modem's direct output with the code you used (which is mostly the corresponding example). It seems that the content of the page you get are hold in the buffer and you may have to use the read(), but I have no clue how it would determine, where the header ends and the content starts because you used a generic TCP connection, it shouldn't have any knowledge of the HTTP protocol.

At least there is a set of manual of the available AT commands.
According to that manual you're using the Direct Push Mode and to receive any content from the server you should send '+QIURC: "recv",0,4' but that's contradictory to what you receive in your example code.

The manuals include a set of AT commands for HTTP. Maybe omitting the library and using them directly may be the better strategy.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.