user72673: I'm using a SIM A9G.  When I send HTTP GET command from the serial monitor, it responds. But, it doesn't work when included in the code.
#include <SoftwareSerial.h>
SoftwareSerial myserial(8, 7); // RX: 8, TX:7

void setup()
{
//  Wire.begin(I2C_SLAVE_ADDRESS);
  Serial.begin(19200);
  myserial.begin(19200);    // 9600, 19200, 38400, 57600, 74880, 115200
  
//  ET.begin(details(mydata), &Wire);
  Serial.println("JSON Initializing...");
  Serial.println("GPRS Starting..........");

//  myserial.listen();
  myserial.println("AT");
  delay(500);

  myserial.println("AT+CREG=?");     //Check Network regiistration, wait a while
  delay(1000);
  ShowSerialData();

  myserial.println("AT+CCID");  //Specify the connection type
  delay(1000);
  ShowSerialData();

  myserial.println("AT+CGATT=1");
  delay(2000);
  ShowSerialData();

  myserial.println("AT+CGDCONT=1,\"IP\",\"web.gprs.mtnnigeria.net\"");//Specify the APN
  delay(2000);
  ShowSerialData();

  delay(2000);
}
 
void loop()
{
  myserial.println("AT+CGATT=1");
  delay(2000);
  ShowSerialData();

  myserial.println("AT+CGACT=1,1");
  delay(2000);
  ShowSerialData();

  myserial.println("AT+HTTPGET=\"https://postman-echo.com/get?foo1=bar1&foo2=bar2\"");
  delay(5000);
  ShowSerialData();

  myserial.println("AT+CCLK?");
  delay(1000);
  ShowSerialData();

  delay(3000);
}

 
void ShowSerialData()
{
  while (myserial.available() != 0)
  {
    Serial.write(myserial.read());
    //delay(50);
  }
}

The output at the serial monitor is the following:
+CGATT:1

OK
AT+CGACT=1,1

OK
E⸮⸮T⸮OZ⸮y:/⸮͵*⸮⸮⸮m/⸮⸮⸮⸮⸮=bar1&foo2=bar2"

+CME ERROR: 53
failure, pelase check your network or certificate!

AT+CCLK?

+CCLK: "21/02/22,18:19:43+01"

OK


user80639: You must use this sequence.
AT+CREG=?
AT+CCID
AT+CGATT=1
AT+CGDCONT=1,"IP","ba.amx"
AT+CGACT=1,1

user80734: a9g module doesn't support https protocol, try using another server that uses http protocol

72673: <p>I'm using a SIM A9G.  When I send HTTP GET command from the serial monitor, it responds. But, it doesn't work when included in the code.</p>
<pre class="lang-cpp prettyprint-override"><code>#include &lt;SoftwareSerial.h&gt;
SoftwareSerial myserial(8, 7); // RX: 8, TX:7

void setup()
{
//  Wire.begin(I2C_SLAVE_ADDRESS);
  Serial.begin(19200);
  myserial.begin(19200);    // 9600, 19200, 38400, 57600, 74880, 115200
  
//  ET.begin(details(mydata), &amp;Wire);
  Serial.println(&quot;JSON Initializing...&quot;);
  Serial.println(&quot;GPRS Starting..........&quot;);

//  myserial.listen();
  myserial.println(&quot;AT&quot;);
  delay(500);

  myserial.println(&quot;AT+CREG=?&quot;);     //Check Network regiistration, wait a while
  delay(1000);
  ShowSerialData();

  myserial.println(&quot;AT+CCID&quot;);  //Specify the connection type
  delay(1000);
  ShowSerialData();

  myserial.println(&quot;AT+CGATT=1&quot;);
  delay(2000);
  ShowSerialData();

  myserial.println(&quot;AT+CGDCONT=1,\&quot;IP\&quot;,\&quot;web.gprs.mtnnigeria.net\&quot;&quot;);//Specify the APN
  delay(2000);
  ShowSerialData();

  delay(2000);
}
 
void loop()
{
  myserial.println(&quot;AT+CGATT=1&quot;);
  delay(2000);
  ShowSerialData();

  myserial.println(&quot;AT+CGACT=1,1&quot;);
  delay(2000);
  ShowSerialData();

  myserial.println(&quot;AT+HTTPGET=\&quot;https://postman-echo.com/get?foo1=bar1&amp;foo2=bar2\&quot;&quot;);
  delay(5000);
  ShowSerialData();

  myserial.println(&quot;AT+CCLK?&quot;);
  delay(1000);
  ShowSerialData();

  delay(3000);
}

 
void ShowSerialData()
{
  while (myserial.available() != 0)
  {
    Serial.write(myserial.read());
    //delay(50);
  }
}
</code></pre>
<p>The output at the serial monitor is the following:</p>
<pre><code>+CGATT:1

OK
AT+CGACT=1,1

OK
E⸮⸮T⸮OZ⸮y:/⸮͵*⸮⸮⸮m/⸮⸮⸮⸮⸮=bar1&amp;foo2=bar2&quot;

+CME ERROR: 53
failure, pelase check your network or certificate!

AT+CCLK?

+CCLK: &quot;21/02/22,18:19:43+01&quot;

OK
</code></pre>
 80639: <p>You must use this sequence.</p>
<p>AT+CREG=?
AT+CCID
AT+CGATT=1
AT+CGDCONT=1,&quot;IP&quot;,&quot;ba.amx&quot;
AT+CGACT=1,1</p>
 80734: <p>a9g module doesn't support https protocol, try using another server that uses http protocol</p>
