sim5320 http post error

Hello!
I’m quite new to arduino and moreso to http commands.

Im using an arduino mega and keyestudio sim5320.

Im trying to use a demo in the adafruit_FONA library called LTE_DEMO to do a http post via 3g to dweet.io however I dont seem to be recieving anything at CHTTPSRECV. here is my code:

// GET request
        sprintf(URL, "GET /dweet/for/%s?temp=%s&batt=%s HTTP/1.1\r\nHost: dweet.io\r\n\r\n", imei, tempBuff, battLevelBuff);

        if (!fona.postData("www.dweet.io", 80, "HTTP", URL)) // Server, port, connection type, URL
          Serial.println(F("Failed to complete HTTP/HTTPS request..."));

and here is my serial monitor:

AT+CHTTPSSTART
	<--- OK
Waiting 1s to ensure connection...
	---> AT+CHTTPSOPSE="www.dweet.io",80,1
	<--- OK
Waiting 1s to make sure it works...
	---> AT+CHTTPSSEND=81
	<--- >
	---> GET /dweet/for/867057031039755?temp=555.96&batt=3700 HTTP/1.1
Host: dweet.io


	<--- OK
	---> AT+CHTTPSSEND
	<--- OK
	<--- +CHTTPSSEND: 0
	---> AT+CHTTPSRECV?
	<--- +CHTTPSRECV: LEN,0
	---> AT+CHTTPSRECV=0
	<--- ERROR
	---> AT+CHTTPSCLSE
	<--- 
Failed to complete HTTP/HTTPS request...

and not sure what is causing it.
Any help would be appreciated!

Im trying to use a demo in the adafruit_FONA library called LTE_DEMO to do a http post via 3g to dweet.io however I dont seem to be recieving anything at CHTTPSRECV.

The Adafruit_FONA library doesn't contain an LTE_DEMO example and it doesn't offer a postData() method. Post a link to the library you're using.

here is my code:

Wrong, that's just three lines of code. Post complete code, the error is usually in that part of the code that you're hiding from us.

if (!fona.postData("www.dweet.io", 80, "HTTP", URL))

Where do you know from that dweet.io supports HTTP for it's API? On it's website it documents only HTTPS to access the API (HTTPS port is 443 not 80).

sorry for the late reply busy day,

the library im using is from here:

im using the demo program from said library LTE_DEMO
I have also tried it with HTTP on port 443 and it returns the same issue

the section im using is here:

#if defined(SIMCOM_3G) || defined(SIMCOM_7500)
    case '3': {
        // Post data to website via 3G or 4G LTE
        float temperature = analogRead(A0) * 1.23; // Change this to suit your needs

        // Voltage in mV, just for testing. Use the read battery function instead for real applications.
        uint16_t battLevel = 3700;

        // Create char buffers for the floating point numbers for sprintf
        // Make sure these buffers are long enough for your request URL
        char URL[150];
        char tempBuff[16];
        char battLevelBuff[16];

        // Format the floating point numbers as needed
        dtostrf(temperature, 1, 2, tempBuff); // float_val, min_width, digits_after_decimal, char_buffer
        dtostrf(battLevel, 1, 0, battLevelBuff);

        // Construct the appropriate URL's and body, depending on request type
        // Use IMEI as device ID for this example

        // GET request
        sprintf(URL, "GET /dweet/for/%s?temp=%s&batt=%s HTTP/1.1\r\nHost: dweet.io\r\n\r\n", imei, tempBuff, battLevelBuff);

        if (!fona.postData("www.dweet.io", 443, "HTTPS", URL)) // Server, port, connection type, URL
          Serial.println(F("Failed to complete HTTP/HTTPS request..."));

        /*
        // POST request
        // You could also try a POST request to something like Ubidots!
        // Make sure to change the device name and token to test it!
        sprintf(URL, "POST /api/v1.6/devices/YOUR_DEVICE_NAME HTTP/1.1\r\nHost: things.ubidots.com\r\nX-Auth-Token: YOUR_TOKEN\r\nContent-Type: application/json\r\nContent-Length: 20\r\n\r\n{\"temperature\":100}\r\n");
        if (!fona.postData("things.ubidots.com", 443, "HTTPS", URL)) // Server, port, connection type, URL
          Serial.println(F("Failed to complete HTTP/HTTPS request..."));
        */
        
        break;
      }
#endif

Still not complete code!

the section im using is here:

Why do you use a completely different service now?

        sprintf(URL, "POST /api/v1.6/devices/YOUR_DEVICE_NAME HTTP/1.1\r\nHost: things.ubidots.com\r\nX-Auth-Token: YOUR_TOKEN\r\nContent-Type: application/json\r\nContent-Length: 20\r\n\r\n{\"temperature\":100}\r\n");

It's definitely bad style if you name a variable URL but it's content is a complete HTTP request. That only works with the current version of that rather scruffy fork of the Adafruit library. At least name the variable "content" or something similar.

I have also tried it with HTTP on port 443 and it returns the same issue

I'm sure it hasn't returned the same lines. Post the output you got!

It's not very clever to test with a service that needs authentication. Do the first tests with a simple HTTPS site that just returns some HTML (you have to use the GET action of course). Once you know that this works you can change to the post action and if you got that running too you can try an authenticated service.